Bring the keyboard capture code up to a higher level