Moved inner for-loop