refactoring code according to
http://wordaligned.org/articles/two-star-programming
makes code in tree.c simplier and more readable