Handled URL and added more checks