Reworked and cleaned up the unit tests.