Download files
Refactor: define type synonyms
Decode filename