Improved tree parser and modifier