Pattern refactoring nearly there ....

I'm gonna merge this myself, then push into master  Bwahahaha!