Worked on uploading, bit of refactoring

Uploading does not work