added sweep function