General synthesis of nanostructured Mo2C electrocatalysts using a carbon template for electrocatalytic applications