Refactoring code and increasing Test coverage.