Fixed bugs. Refactored code. Repaired unit tests.