Improved mem_list_to_tri_list