Revamp dupload code