Cleanup.
Added some unit tests.