Added event system

Implemented the event management system