if you want to take async as a dependency, that's totally okay (for the filecount stuff).

could also use named functions to reduce the nesting, but that's up to you, it's clean enough as-is