refactor usedUrl function