replaced with foreach