Added a bunch of new tests, cleaned up code, and began documenting code base