some changes in keyboard code