turned pieces from array to a map (=object in js terminology)