Filter optimizations and bugfixes