Merged step 5 of solution