Updated calc.c to use the updated tree structure