passing back query to callback