Added URL retrieval processing code prior to file writeout, sorted out format for stringing together final_url.