Lacrymology/xaiki/event emitter

Replayed relevant commits from #58, fixed conflicts, and made tests pass.