Refactor url validator