Added some keyboard support.

Currently supports "Escape".
Moved registration of functions to jgsCreate.
Added some error checking and proper cleanup.