Refactor and readiness for test coverage