Re-designed downloading logic.