Limit number of retries for failed uploads, code cleanup, make constants for some string values