Added validation for invalid url format