Improve KeyPress handling to be stricter