Added .on() method to subscribe to events.