Cleaned up unit tests, added more documentation