Added downloading logic