change the data structure from list to dictionary