Made eventhandling more consistent with general state management
Fixed segfault on unknown keypress