Speed up search, with better input detection