Revert "Fixed queries for global analysis." New code in and old version committed.

This reverts commit 90b6f43cf4171a23bfa5b59a01b17453dcff2c38.