changed array into objects