completed and tested urlValid function