Keyboard input code almost finished.