move clean to thread