Added better graph element resolution, and more performant with trees.