Query 4 Optimization incomplete.

Work in progress.