Hooked up the patterns with a listener