Clean up the filter code to fix filter combination bugs.