halfway done with key press function