Changed to read a file or url
Refactored for DRY and check for validity of URL.