Minor refactoring and attack verification before sending event to server