refactored autocomplete usage