Add the mask list to the input options for stats
Rename filter with mask, to make clear what is happening
Rename all the f-> pointers to m-> pointers