Pattern-logic and tests implemented - still a bit verbose