It's not actually an extra query. The old code was doing too many queries: first to get all descendant and for each descendant another query was executed (<code>all_files += folder.files</code>) to get all files. Since the whole point of this logic is to iterate through all descendants files i thought that it's better to do it in two queries instead of executing a query for each descendant.