Refactored ui calculations into calculator class