Refactor. Prepare code for better test coverage.