Restructure "each" block