Added Pattern implementation plus examples. Restructured things.
Bugfixes and tests for Patterns