Finished part 2, added unit tests