Refactoring code to do a better validation for input url. Also adding log4j to replace System.out. Adding logic to write the output into a text file.