added query promise chaining support