Updated file management and cleaning