refactored updated solution for learn document downloading