Optimization
MOD optimization for speed by finding perfect match first