Typeaheads refactor