Added a foreach to cycle through data array