Major refactoring and cleanup

Finally got the algorithm for problem 10 to work.
Did some major refactoring across the board.