cleanup old for loop implementation