reduce and filter