Is it possible to make this return the new map instead of modify one of the parameters as a side effect?