First loop closer working version.