Improvements to events. Added event sample.