Some refactoring and calling put_file method to upload files to Dropbox