Make little refactoring on working with typeahead