Refactor the solution.