Set up the functions so the tree simplification functionality can be added easily on top of that.