Step 2 done. Needs refactoring.