Refactor code to improve Code Climate grade.