Added better handling of orbits.