updated to do array of objects