changed forEach to foreach