tree builder
cleanup tree