Added pattern recognition