completed main feature of cleanup script