update to handle arrays of objects