Use map instead of a clunky for-loop

Sorry, could not resist ;)