use Data.Map for much nicer p5 solution