Bug 890326 - use a filtered query as the filtered query's query
Review fixes and some code cleanup