A major refactoring of Patter into many modules.