iteration 6: refactoring