Fix ping reply fields.
Refactor event handling.