removed a lot of shit and added a trim function for the autocomplete