Iteration 1 with lots of refactoring