Basic pattern recognition script