Added function G.getPlanet() to get a planet by index. Also refactored
code to use this function.