Refactor MVC in calculator