Flattened code to help wrapping for other languages and implemented rudimentary keymaps