Refactoring autocomplete extension