Raw Input version

Re-implemented the key detection using Raw Input, this approach seems to
be more flexible in terms of devices, however it is a lot more work to
figure out.