Refactor Homework 4 - remove excess code