Unit tests WIP.
Fix tests.
Add test.