Refactoring filter_module