diff --git a/src/lib.rs b/src/lib.rs
index 02f623442368fac834e6a110c5ab9206e8367b4b..c8a51b0752f5f509027149e25b703eef714458e2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -51,6 +51,17 @@ extern crate error_chain;
 #[macro_use]
 extern crate lazy_static;
 
+mod crates {
+    // public
+    // pub extern crate error_chain;
+    #[cfg(feature="serde_yaml")]
+    pub extern crate serde_yaml;
+    pub extern crate yaml_rust;
+
+    // private
+    pub extern crate itertools;
+}
+
 mod error;
 mod merge_keys;
 #[cfg(feature="serde_yaml")]
diff --git a/src/merge_keys.rs b/src/merge_keys.rs
index e97afa1e22ef1f8041cc73e9c0621b72fbedcef7..d5f7bc846e6b0b50d9cc3dd8159ff8b3724e5aa7 100644
--- a/src/merge_keys.rs
+++ b/src/merge_keys.rs
@@ -6,12 +6,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern crate itertools;
-use self::itertools::Itertools;
-
-extern crate yaml_rust;
-use self::yaml_rust::Yaml;
-use self::yaml_rust::yaml::{Array, Hash};
+use crates::itertools::Itertools;
+use crates::yaml_rust::Yaml;
+use crates::yaml_rust::yaml::{Array, Hash};
 
 use error::*;
 
diff --git a/src/serde.rs b/src/serde.rs
index e85991b6c9248e202a145e0dc624b8e714dbb2e8..befddc798419f10286299d6651dcafbf54fd9891 100644
--- a/src/serde.rs
+++ b/src/serde.rs
@@ -6,11 +6,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern crate serde_yaml;
-use self::serde_yaml::Value;
-
-extern crate yaml_rust;
-use self::yaml_rust::Yaml;
+use crates::serde_yaml::Value;
+use crates::yaml_rust::Yaml;
 
 use error::*;
 use merge_keys;
diff --git a/src/test.rs b/src/test.rs
index 07d504641e036028539c36d2d5b7881825e7effb..0eef2814197ccb39cda18f841170cfbf9c6ed4da 100644
--- a/src/test.rs
+++ b/src/test.rs
@@ -6,8 +6,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern crate yaml_rust;
-use self::yaml_rust::Yaml;
+use crates::yaml_rust::Yaml;
 
 use error::ErrorKind;
 use merge_keys::merge_keys;