added tree unit tests, other minor changes