Cleanup and refactor the solution.