added validation to pattern's model