refactored upload javascript to include namespace and js doc comments