Adding unit tests.
Fixing bugs. Getting tests passing.