Improve query callback to be async