autocomplete code cleanup