Decrease code duplication and increase speed when dealing with spheres