put new block dir code in inner loop