Completed to make sweeping function.