filter bug fixes / refactoring