An implementation of various Tree functions