Implement a map merge function