diff --git a/R/readdesign.R b/R/readdesign.R
index 699ff04168f6385b187919c7fb9e49a162c21ff2..fb67522dfc23f948ee52320dc6c3b9d85928cf36 100644
--- a/R/readdesign.R
+++ b/R/readdesign.R
@@ -22,22 +22,22 @@
 
 readdesign <- function(design = designfile, designtype = NULL) {
 
-  # if (is.null(designtype)) {
-  #
-  #
-  #
-  #   # Check if the string ends with ".ngd"
-  #   if (grepl("\\.ngd$", designfile)) {
-  #     # Code to execute if condition is true
-  #     designtype = "ngene"
-  #     print("I guessed it is an ngene file")
-  #   } else {
-  #     # Code to execute if condition is false
-  #     designtype = "spdesign"
-  #     print("I assume it is a spdesign")
-  #   }
-  #
-  # }
+  if (is.null(designtype)) {
+
+
+
+    # Check if the string ends with ".ngd"
+    if (grepl("\\.ngd$", designfile)) {
+      # Code to execute if condition is true
+      designtype = "ngene"
+      print("I guessed it is an ngene file")
+    } else {
+      # Code to execute if condition is false
+      designtype = "spdesign"
+      print("I assume it is a spdesign")
+    }
+
+  }
 
   design <- switch(designtype,
                    "ngene" = suppressWarnings(readr::read_delim(design,
diff --git a/inst/extdata/spdesigns/designs/twoattr.RDS b/inst/extdata/spdesigns/designs/twoattr.RDS
index e43085bd732b5cf4297e08b3593992b6dfb325bf..82c9b6f4031b5f3193bbf369c70cbae2b9e6d30e 100644
Binary files a/inst/extdata/spdesigns/designs/twoattr.RDS and b/inst/extdata/spdesigns/designs/twoattr.RDS differ
diff --git a/tests/testthat/test-readdesign.R b/tests/testthat/test-readdesign.R
index caf80a3b6182469775d37275c73fdd9285095a97..97a3658fc86d52b2d2e5ee63841834e67e80dd8e 100644
--- a/tests/testthat/test-readdesign.R
+++ b/tests/testthat/test-readdesign.R
@@ -15,14 +15,27 @@ test_that("all is correct", {
   expect_no_error(readdesign(design = design_path, designtype = "ngene"))
 })
 
+# test if autodetect ngd design
+
+test_that("all is correct", {
+  expect_no_error(readdesign(design = design_path))
+})
+
+
 ### Tests for spdesign
 
-design_path <- system.file("extdata","CSA", "design2.RDS" ,package = "simulateDCE")
+design_path <- system.file("extdata","CSA", "linear", "BLIbay.RDS" ,package = "simulateDCE")
 
 test_that("all is correct", {
   expect_no_error(readdesign(design = design_path, designtype = "spdesign"))
 })
 
+# Same Tests for spdesign, but detect automatically if it is spdesign
+
+test_that("all is correct", {
+  expect_no_error(readdesign(design = design_path))
+})
+
 
 ## trying objects that do not work