Added a publish/subscribe system for events, alongside an EventManager class to take care of all that.