Allow the pattern environment to be extended by invoked macros
Refactor loadPatterns to 1 pass. Implicitly call invoke for custom classes.