cleaned up the mess i made earlier in build_tree()