Rewrite tree balancing. Failed in that respect. Let's write tests.