Move typeahead stuff to model