Broke out generator and tree functions out to their own modules.

Some initial test code going in.