Refactor specific autocomplete functions