Implemented unittests and got them all passing.