modified to improve reliability when it select the remove files