reassembly algorithm