Could you do this same function again, except using templates so that the input map isn't restricted to ints?