Add merge_lists function and tests