reformat filter function