Change arrays to dictionaries