Consolidate refs to upload directories and urls, code cleanup
Refactor code, more useful varnames