Up to step 6 - refactored