minor modifications. Start of the autocomplete function