Firstcut not-very-elegant-solution
Better solution
Cleaned up code by extracting methods for readability
Added main method