A set of functions for working with trees