Change the calculator to use input handler instead of using the tree directly