Use foreach instead of for