change to foreach