refactor: removed some unnecessary loops in file list building