Finished query_mod.py