Improve handling of events and properties