Added functions to work with spherical coordinates