refactor autoComplete