use a reversed foreachloop only when you want to remove and that should do the trick tested and applied