Remove useless foreach loop