working on caching parsed subtrees