refactoring 'autocomplete' ui