edited to correct query