move writing functionality out of total_cloud method