Added hooks to QueryEvents