code cleanup, move input logic to keyboard class