Add file upload/download and refactor