Code refactor, iteration 1