Removing last for loop

Removing last for loop