Updated query program