adding ArcGIS http(s) ports
handle trailing slashes on view URLs
refactored to reduce functions, clean up file handling