replace incorrect term "scan code" with "frame"
rename argument to reflect correct terminology
split keyboard handling functionality