Error handling, fixed globals, removed readable keymap.