refactor(core, #41): major improvements and adds support for event handling