Implemented new unit tests. Fixed defect.