Added functions to calc.rb