```python
def merge(a, b):
    """
    Merges two already sorted lists into a single sorted list.
    This function is a core component of the merge sort algorithm.

    Args:
        a: A sorted list of comparable elements.
        b: Another sorted list of comparable elements.

    Returns:
        A new list containing all elements from a and b in sorted order.
    """
    merged_list = []
    index_a = 0
    index_b = 0

    # Loop while both lists have elements to compare
    while index_a < len(a) and index_b < len(b):
        if a[index_a] <= b[index_b]:
            merged_list.append(a[index_a])
            index_a += 1
        else:
            merged_list.append(b[index_b])
            index_b += 1

    # Append any remaining elements from list a.
    # If list a is exhausted, this slice will be empty.
    merged_list.extend(a[index_a:])

    # Append any remaining elements from list b.
    # If list b is exhausted, this slice will be empty.
    merged_list.extend(b[index_b:])

    return merged_list
```