modified first phase query