Unit tests, bug fixes.