updated query controller