implement optional masks with greede false option - see readme