Event system

First attempt for the event system working.