Fixing up spherical and polar coords.
Factorial function.