completed checkUrl function