updated department query