pass preprocessing fn as mask