Seperated autocomplete and search code flow