Major refactor: changed the return type of most statements to return a TreeNode