Refactor seq to array and map to dictionary