diff --git a/main/ntrip-client.hs b/main/ntrip-client.hs
--- a/main/ntrip-client.hs
+++ b/main/ntrip-client.hs
@@ -10,11 +10,7 @@
 import System.IO
 
 data Args = Args
-  { host     :: ByteString
-  , port     :: Maybe Int
-  , path     :: ByteString
-  , user     :: ByteString
-  , password :: ByteString
+  { url :: ByteString
   } deriving (Show, Generic)
 
 instance ParseRecord Args
@@ -27,12 +23,5 @@
 main :: IO ()
 main = do
   args <- getRecord "NTRIP Client"
-  runNtrip
-    (host args)
-    (fromMaybe 2101 $ port args)
-    (path args)
-    (user args)
-    (password args)
-    sourceNull
-    (mapM_ output)
+  runNtrip (url args) sourceNull (mapM_ output)
 
diff --git a/ntrip-client.cabal b/ntrip-client.cabal
--- a/ntrip-client.cabal
+++ b/ntrip-client.cabal
@@ -1,5 +1,5 @@
 name:                  ntrip-client
-version:               0.1.1
+version:               0.1.2
 synopsis:              NTRIP client.
 description:           Networked Transport of RTCM via Internet Protocol client.
 license:               BSD3
@@ -20,10 +20,13 @@
                      , base >= 4.7 && < 5
                      , base64-bytestring
                      , basic-prelude
+                     , bytestring
                      , case-insensitive
                      , conduit
                      , conduit-extra
                      , http-types
+                     , lens
+                     , uri-bytestring
 
 executable ntrip-client
   hs-source-dirs:      main
@@ -35,5 +38,4 @@
                      , bytestring
                      , conduit
                      , ntrip-client
-                     , optparse-generic
                      , optparse-generic
diff --git a/src/Network/Ntrip/Client.hs b/src/Network/Ntrip/Client.hs
--- a/src/Network/Ntrip/Client.hs
+++ b/src/Network/Ntrip/Client.hs
@@ -1,18 +1,21 @@
-{-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE OverloadedStrings #-}
 
 module Network.Ntrip.Client where
 
-import BasicPrelude
-import Control.Concurrent.Async
-import Data.Attoparsec.ByteString
-import Data.Attoparsec.ByteString.Char8  (decimal, endOfLine, isEndOfLine)
-import Data.ByteString.Base64
-import Data.CaseInsensitive
-import Data.Conduit
-import Data.Conduit.Attoparsec
-import Data.Conduit.Network
-import Network.HTTP.Types
+import           BasicPrelude                     hiding (intercalate, tail)
+import           Control.Concurrent.Async
+import           Control.Lens
+import           Data.Attoparsec.ByteString
+import           Data.Attoparsec.ByteString.Char8 (decimal, endOfLine, isEndOfLine)
+import           Data.ByteString
+import           Data.ByteString.Base64
+import           Data.CaseInsensitive
+import           Data.Conduit
+import           Data.Conduit.Attoparsec
+import           Data.Conduit.Network
+import           Network.HTTP.Types
+import           URI.ByteString
 
 tcpClient :: ByteString -> Int -> Source IO ByteString -> Sink ByteString IO () -> IO ()
 tcpClient host port source sink =
@@ -21,7 +24,7 @@
 
 sourceNtrip :: ByteString -> ByteString -> ByteString -> Source IO ByteString -> Source IO ByteString
 sourceNtrip path user password source = do
-  yield $ intercalate "\r\n" $
+  yield $ intercalate "\r\n"
     [ methodGet <> " " <> path <> " HTTP/1.0"
     , original hUserAgent <> ": NTRIP ntrip-client/0.0"
     , original hAuthorization <> ": " <> encode (user <> ":" <> password)
@@ -51,6 +54,17 @@
   unless (status == status200) $ throwIO $ userError "Bad status"
   sink
 
-runNtrip :: ByteString -> Int -> ByteString -> ByteString -> ByteString -> Source IO ByteString -> Sink ByteString IO () -> IO ()
-runNtrip host port path user password source sink =
-  tcpClient host port (sourceNtrip path user password source) (sinkNtrip sink)
+runNtrip :: ByteString -> Source IO ByteString -> Sink ByteString IO () -> IO ()
+runNtrip url source sink = do
+  uri  <- either (throwIO . userError . textToString . show) return $ parseURI strictURIParserOptions url
+  auth <- maybe (throwIO $ userError "Bad authority") return $ uri ^. authorityL
+  ui   <- maybe (throwIO $ userError "Bad user info") return $ auth ^. authorityUserInfoL
+  tcpClient
+    (hostBS $ auth ^. authorityHostL)
+    (fromMaybe 2101 $ portNumber <$> auth ^. authorityPortL)
+    (sourceNtrip
+      (tail $ uri ^. pathL)
+      (ui ^. uiUsernameL)
+      (ui ^. uiPasswordL)
+      source)
+    (sinkNtrip sink)
