smart(er) autocomplete with key up and key down