refactoring, cleaning up tree a bit