Refactor/file upload