archives uploading code fixed/refactored