rewritten download backend