refactor the calculator.rb