hw4 final commit

Added unit tests and made a few changes.