Added support for configuring keyboard shortcuts.

Massive refactoring regarding input.
Minor improvements.