refactored scapes to use trees, and added some tree utils