diff --git a/hyfabric/DESCRIPTION b/hyfabric/DESCRIPTION
index 169d7f82c8f8f454c5413242ed91e8e4c6abd4da..b3749dba749a7a3620846b0924817f9e0946b642 100644
--- a/hyfabric/DESCRIPTION
+++ b/hyfabric/DESCRIPTION
@@ -1,7 +1,7 @@
 Package: hyfabric
 Type: Package
 Title: Utility functions for creating the reference geospatial fabric.
-Version: 0.3.0
+Version: 0.4.0
 Authors@R: c(person(given = "David", 
                     family = "Blodgett", 
                     role = c("aut", "cre"), 
diff --git a/hyfabric/R/networkconnection.R b/hyfabric/R/networkconnection.R
index 4ba7201f2aff9585795032893680910d1da5f57e..56c360f0543d2356b71a84fb5ba04cca8eba3c4e 100644
--- a/hyfabric/R/networkconnection.R
+++ b/hyfabric/R/networkconnection.R
@@ -1,61 +1,65 @@
 #' Identifies and connects dangles in network generated by Network Nav function
-#' @param inCOM  list list of input COMIDs 
+#' @param inCOM  list list of input COMIDs
 #' @param nhdDF sf data.frame (data frame) valid data frame of NHD flowlines
 #' @import dplyr
 #' @return (list) list of COMIDs connecting dangle to existing network
 #' @export
-#' @examples 
+#' @examples
 #' source(system.file("extdata", "sample_flines.R", package = "nhdplusTools"))
-#' 
+#'
 #' sample_flines <- nhdplusTools::prepare_nhdplus(sample_flines, 0, 0, 0, FALSE) %>%
 #'   left_join(select(sample_flines, COMID, DnHydroseq, DnLevelPat, Pathlength))
-#' 
-#' comid <- sample(sample_flines$COMID, 10) 
-#' 
+#'
+#' comid <- sample(sample_flines$COMID, 10)
+#'
 #' NetworkConnection(comid, sample_flines)
 
 NetworkConnection <- function(incom, nhd, status = FALSE){
-  
+
+  nhd <- dplyr::group_by(nhd, LevelPathI) %>%
+    dplyr::mutate(DnLevelPat = min(DnLevelPat)) %>%
+    dplyr::ungroup()
+
   upnet_DF <- filter(nhd, COMID %in% incom) %>%
     filter(!DnHydroseq %in% Hydroseq)
-  
+
   # while the number of dangles is greater than 0
   while (length(upnet_DF$COMID) > 0) {
-    
+
     # create item for number of dangles
     count <- dim(upnet_DF)[1]
-    
+
     if(status)
       message(dim(upnet_DF))
-    
+
     # find out which level paths are downstream of dangling huc12 POIs
     DSLP <- upnet_DF %>% pull(DnLevelPat)#[upnet_DF$COMID %in% incom]
-    
+    CLP <- upnet_DF %>% pull(LevelPathI)
+
     # Get the COMID of the hydroseq with level path value
     # the lowest downstream flowline within the levelpath
-    inCom2 <- nhd$COMID[nhd$Hydroseq %in% DSLP]
-    
+    inCom2 <- nhd$COMID[nhd$Hydroseq %in% c(DSLP, CLP)]
+
     # Run the upstream navigation code
-    
-    
+
     upNet <- unique(unlist(lapply(inCom2, function(x, nhd) {
       nhdplusTools::get_UM(nhd, x, include = TRUE)
     }, nhd = nhd)))
-    
+
     # Append result to existing segment list
     incom <- append(incom, upNet)
-    
+
     # Get the same variable as above
     upnet_DF <- filter(nhd, COMID %in% incom, !DnHydroseq %in% Hydroseq)
-    
+
     # Get the count
     count2 <- dim(upnet_DF)[1]
-    
+
     # if the count has remained the same we are done and return the flowline list
     if (count == count2){
       return (incom)
     }
   }
-  
+
   return(incom)
 }
diff --git a/hyfabric/man/NetworkConnection.Rd b/hyfabric/man/NetworkConnection.Rd
index f1e4b842a8e2a1e8fd22d9bea75a78edbac5bca8..698ebd30509544e7f44005d2a493a6b2f0e9ba44 100644
--- a/hyfabric/man/NetworkConnection.Rd
+++ b/hyfabric/man/NetworkConnection.Rd
@@ -23,7 +23,7 @@ source(system.file("extdata", "sample_flines.R", package = "nhdplusTools"))
 sample_flines <- nhdplusTools::prepare_nhdplus(sample_flines, 0, 0, 0, FALSE) \%>\%
   left_join(select(sample_flines, COMID, DnHydroseq, DnLevelPat, Pathlength))
 
-comid <- sample(sample_flines$COMID, 10) 
+comid <- sample(sample_flines$COMID, 10)
 
 NetworkConnection(comid, sample_flines)
 }
diff --git a/hyfabric/tests/testthat/test_networkconnection.R b/hyfabric/tests/testthat/test_networkconnection.R
index cfccc68807d12eba9a72f7d5baac9b2f400c403c..5888eda2e563093b5f0ca463e67e621c9f87cc65 100644
--- a/hyfabric/tests/testthat/test_networkconnection.R
+++ b/hyfabric/tests/testthat/test_networkconnection.R
@@ -12,17 +12,22 @@ test_that("networkconnection", {
 
   sample_flines <- nhdplusTools::make_standalone(sample_flines)
 
+  sample_flines$DnLevelPat[is.na(sample_flines$toCOMID)] <- NA
+  sample_flines$DnHydroseq[is.na(sample_flines$toCOMID)] <- NA
+
   comid <- c(11689684, 11690056, 11688856, 11687550, 11691374, 11690260)
 
   out <- NetworkConnection(comid, sample_flines)
 
-  testthat::expect_equal(length(out), 128)
+  testthat::expect_equal(length(out), 235)
 
+  # sub <- sf::st_geometry(filter(sample_flines, COMID %in% out))
+  #
   # plot(sf::st_geometry(sample_flines), col = "blue", lwd = 1)
   # plot(sf::st_geometry(filter(sample_flines, COMID %in% out)), col = "blue", lwd = 2, add = TRUE)
   #
 })
-
+#
 # reprex::reprex({
 #
 #   library(nhdplusTools)
@@ -38,13 +43,15 @@ test_that("networkconnection", {
 #
 #   sample_flines <- nhdplusTools::make_standalone(sample_flines)
 #
+#   sample_flines$DnLevelPat[is.na(sample_flines$toCOMID)] <- NA
+#   sample_flines$DnHydroseq[is.na(sample_flines$toCOMID)] <- NA
+#
 #   comid <- c(11689684, 11690056, 11688856, 11687550, 11691374, 11690260)
 #
 #   out <- NetworkConnection(comid, sample_flines)
 #
 #   testthat::expect_equal(length(out), 128)
 #
-#
 #   # Note there is some disconnected network.
 #
 #   #We can do this with hyRefactor...
diff --git a/workspace/R/NHD_navigate.R b/workspace/R/NHD_navigate.R
index 502383223d1c67507b4a13be982492eb20ef85b5..2382dfe86c579277521d8c1b6e4d9b65a1ef84b3 100644
--- a/workspace/R/NHD_navigate.R
+++ b/workspace/R/NHD_navigate.R
@@ -15,45 +15,45 @@ NetworkNav <- function(inCom, nhdDF, withTrib){
   return(seg)
 }
 
-
-#' Identifies and connects dangles in network generated by Network Nav function
-#' @param inCOM  (list) list of input COMIDs 
-#' @param nhdDF (sf data.frame) (data frame) valid data frame of NHD flowlines
-#' @param withTrib (logical) flag for if the upstream navigation should include tributaries
-#              or stick to mainstem level path
-#
-#' @return (list) list of COMIDs connecting dangle to existing network
-NetworkConnection <- function(incom, nhd){
-
-  upnet_DF <- filter(nhd, COMID %in% incom) %>%
-    filter(!DnHydroseq %in% Hydroseq)
-  
-  # while the number of dangles is greater than 0
-  while (length(upnet_DF$COMID) > 0){
-    # create item for number of dangles
-    count <- dim(upnet_DF)[1]
-    print (dim(upnet_DF))
-    # find out which level paths are downstream of dangling huc12 POIs
-    DSLP <- upnet_DF %>% pull(DnLevelPat)#[upnet_DF$COMID %in% incom]
-    # Get the COMID of the hydroseq with level path value
-    # the lowest downstream flowline within the levelpath
-    inCom2 <- nhd$COMID[nhd$Hydroseq %in% DSLP]
-    # Run the upstream navigation code
-    upNet <- unique(unlist(lapply(inCom2, NetworkNav, nhd)))
-    # Append result to existing segment list
-    incom <- append(incom, upNet)
-    # Get the same variable as above
-    upnet_DF <- filter(nhd, COMID %in% incom, !DnHydroseq %in% Hydroseq)
-    # Get the count
-    count2 <- dim(upnet_DF)[1]
-    # if the count has remained the same we are done and return the flowline list
-    if (count == count2){
-      return (incom)
-    }
-  }
-  # Not sure this other return is needed
-  return(incom)
-}
+#' ### DEPRECATED ###
+#' #' Identifies and connects dangles in network generated by Network Nav function
+#' #' @param inCOM  (list) list of input COMIDs 
+#' #' @param nhdDF (sf data.frame) (data frame) valid data frame of NHD flowlines
+#' #' @param withTrib (logical) flag for if the upstream navigation should include tributaries
+#' #              or stick to mainstem level path
+#' #
+#' #' @return (list) list of COMIDs connecting dangle to existing network
+#' NetworkConnection <- function(incom, nhd){
+#' 
+#'   upnet_DF <- filter(nhd, COMID %in% incom) %>%
+#'     filter(!DnHydroseq %in% Hydroseq)
+#'   
+#'   # while the number of dangles is greater than 0
+#'   while (length(upnet_DF$COMID) > 0){
+#'     # create item for number of dangles
+#'     count <- dim(upnet_DF)[1]
+#'     print (dim(upnet_DF))
+#'     # find out which level paths are downstream of dangling huc12 POIs
+#'     DSLP <- upnet_DF %>% pull(DnLevelPat)#[upnet_DF$COMID %in% incom]
+#'     # Get the COMID of the hydroseq with level path value
+#'     # the lowest downstream flowline within the levelpath
+#'     inCom2 <- nhd$COMID[nhd$Hydroseq %in% DSLP]
+#'     # Run the upstream navigation code
+#'     upNet <- unique(unlist(lapply(inCom2, NetworkNav, nhd)))
+#'     # Append result to existing segment list
+#'     incom <- append(incom, upNet)
+#'     # Get the same variable as above
+#'     upnet_DF <- filter(nhd, COMID %in% incom, !DnHydroseq %in% Hydroseq)
+#'     # Get the count
+#'     count2 <- dim(upnet_DF)[1]
+#'     # if the count has remained the same we are done and return the flowline list
+#'     if (count == count2){
+#'       return (incom)
+#'     }
+#'   }
+#'   # Not sure this other return is needed
+#'   return(incom)
+#' }
 
 
 #' Switches valid POIs from minor to major path divergences
diff --git a/workspace/hyfabric_0.3.0.tar.gz b/workspace/hyfabric_0.3.0.tar.gz
deleted file mode 100644
index 9bef8e209ee1e2775dae07c2d0842da0bd058ae0..0000000000000000000000000000000000000000
Binary files a/workspace/hyfabric_0.3.0.tar.gz and /dev/null differ
diff --git a/workspace/hyfabric_0.4.0.tar.gz b/workspace/hyfabric_0.4.0.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..39974852eac028dc8617772324aff7fcc19f0568
Binary files /dev/null and b/workspace/hyfabric_0.4.0.tar.gz differ