Fixing spherical coords and 3d rotation funcs