Refactored sanitize, and exported sanitize on parse tree.