Keyboard wrapper, depth added

Hacked some changes in the threading stack. Needs to be fixed.