Cleanup the main module
Clarify docs
Save token before upload

Makes sure that the token is saved even if the upload fails.