refactored url validator