Auto deduce remote URL for doc-upload
Remove unused macro
Add new header for memory management