A bit better event handling.