ncase m1 with custom loop