Changed the math function to be a template function.