Fixed some bugs. Part 1 works

Govind's part 2 code has some errors so it's temporarily commented out.