Made a for in loop instead of normal for loop