added more foreach loops