Added some class-level comments and a lot of tests.