improved search to prioritize sequential matches