Implements typeahead.