Actually looked at the HyperSpec, and replaced my silly tree-replace function with the standard one.