swapping for loop for map per issue #268