instructions for refactoring filter function