Added tests for variable substitution
Fixed a bug that could cause incorrect trees with certain large expressions.
Added more tests for parentheses.