Change match end event to reset all match state.
Some style improvements.