Added a docstring to filterpass, and reversed the if check for it in the infinite loop to reduce the amount of indentation used