Made For loop neater (reverted from commit 327320d7598c8f1b9b22eea7920d7547ff15c202)