Extracted upload related code to a new module