Updating deviceDriverKeyboard

Went through the code and there was some repetition. I created a
function for the code that was the same rather than repeating the same
thing in one function.