Refactor calculator.rb