Implemented keyboard support. (Commit catchup part 1/2)