Bug 813978 - Part 2: rewrite filtering by only one condition
Bug 813978 - Part 3: rewrite filtering by mix of any two conditions