changed map to one-dimensional array for the sanity of my brain... :)