handles queries now