Added validateUrl function