implemented foreach