`event.data` is used couple of times here, consider caching it in local variable?