Use TMxpElement as a value class to avoid memory leaks.
Don't allocate TEvent on the heap.

It is not necessary and it fixes various memory leaks.