Cleaned up the AutoComplete function