Cleaned up some comments and beefed up the unit tests