Final optimizations for searching.