cleanup and more tree stuff