Refactor part 1.  Compiles and runs correctly