Cleaned up event handling in core
Small cleanups