Refactored step 4