Implemented some unit tests, fixed a few bugs
Added a few tests/documentation, fixed a few bugs