Custom events implementation

See #68. Still WIP.