refactored reading url