Refactor the View class in calculator