Change a couple of for loops to map calls