Revert "Removed loop"

This reverts commit f9a031deeca661426d0676a4ff9f8ace90c1ddbd.
Removed loop properly