More refactoring changes. Also modified logic to handle errors with https links in captureURL.groovy