Fix duplicate filenames handling
Improve how files and directories are filtered
Improve caching for project files and root