Fix to run tests.
Add some unit tests.