Changed URL generation to use URL library