Refactor to improve test coverage to 72.2%