I think a helper function to represent the filtering operation would help.