re-organizing queries