Minor refactoring for Week 1 assignment