Full unit test coverage and needed code fixes.