initial typeahead logic