fully optimized contains search