Cleaning up stack in for loop body