changed forEach to for