organize code
added upload into the process