Updated: defined the functions within Calc.