Refactor foundation of solution for orbits