got unit tests working
documented as much as possible, fixing a few bugs along the way