Tidied up tree generation code. Added a few more subtree options.