Refactored - Added Pattern Superclass

Added the pattern superclass to simplify the pattern code.