updated query stuff