switched from function pointers to a switch statement for evaluating nodes