Updated character autocomplete code