adds documentation to merge function