Refactored code before iteration 6.