Tree operations. Will add tests later.