Repaired unit tests. Code coverage: up to 95%. Minor code refactoring.