Tidy up code for Course Project 1