Move filter function to an actual function for clarity.