Refactor checkUrl