tweaked write_list()