Re-organizing code for Trees.