Cleaned up calc.rb code