refactored code to use calculator object/methods