removed code from early testing, placed autocomplete code in a function