Refactor Code for Document Cleaner