upload re-factor