Added initial test framework.
Moved high level tree stuff to its own module.