Initial autocomplete code, needs cleanup