extract into typeahead controller