Refactor directories, files, and scanning.