Cleanup of autocomplete code