refactored and prepared for data cleaning. Fix URL parsing