Incorporate Chris's optimizations for sequence matching.