Homework3

Passed the tests, and did a bunch of refactoring.