reverted some changes
changed itaration over rows