Added in AddEvent code from v4 version