new mask algorithim
reworked threshold system