almost finished query module.