removed second foreach