Clean replace of sweep_record

with Rossen's updated version