Adding keyboard manager logic.

This is currently very broken.