diff --git a/drush/modernizr.drush.inc b/drush/modernizr.drush.inc
index d9528e1..a2a003b 100644
--- a/drush/modernizr.drush.inc
+++ b/drush/modernizr.drush.inc
@@ -71,39 +71,47 @@ function modernizr_drush_help($section) {
  */
 function _modernizr_drush_download_dev() {
   $args = func_get_args();
+  $dir = '';
+  $drush_context = '';
 
-  // If a path was passed to drush use it
+  // If the user supplied a destination, use that path
   if ($args[0]) {
-    $path = $args[0];
+    $dir = $args[0];
   }
-  // Otherwise fall back on the two default locations
-  // depending on if Libraries API is installed
+  // Otherwise we need to use one of the two default locations.
+  // Depends on whether Libraries API is enabled or not.
   else {
-    $path = drush_get_context('DRUSH_DRUPAL_ROOT');
+    $drush_context = drush_get_context('DRUSH_DRUPAL_ROOT');
     if (module_exists('libraries')) {
-      $libraries_path = libraries_get_path('modernizr');
-      $path .= $libraries_path ? '/'. $libraries_path : '/sites/all/libraries/modernizr';
+      $libraries_dir = libraries_get_path('modernizr');
+      $dir = $libraries_dir
+           ? $drush_context .'/'. $libraries_dir
+           : $drush_context .'/sites/all/libraries/modernizr';
     }
     else {
-      $path .= '/' . drupal_get_path('module', 'modernizr') . '/js';
+      $dir = $drush_context .'/'. drupal_get_path('module', 'modernizr') .'/js';
     }
   }
 
-  // If the directory containing the library present?
-  if (is_dir($path)) {
+  // Build full path including filename
+  $path = _modernizr_scan_for_library(array($dir));
+
+  // If the directory exists and contains a recognized file, we're finished.
+  if (modernizr_get_path()) {
     drush_log('Modernizr already present. No download required.', 'ok');
     return;
   }
-
-  // Create the directory
-  drush_mkdir($path);
-
-  // Download library and report the outcome
-  if (drush_op('chdir', $path) && drush_shell_exec('wget '. MODERNIZR_DOWNLOAD_DEV)) {
-    drush_log(dt('The latest Modernizr dev library has been downloaded to @path', array('@path' => $path)), 'success');
-  }
   else {
-    drush_log(dt('Drush was unable to download Modernizr dev to @path', array('@path' => $path)), 'error');
+    // The file was not present. Create the directory to hold it.
+    drush_mkdir($dir);
+
+    // Attempt to download the file and log the outcome.
+    if (drush_op('chdir', $dir) && drush_shell_exec('wget '. MODERNIZR_DOWNLOAD_DEV)) {
+      drush_log(dt('The latest Modernizr dev library has been downloaded to @path', array('@path' => $dir)), 'success');
+    }
+    else {
+      drush_log(dt('Drush was unable to download Modernizr dev to @path', array('@path' => $dir)), 'error');
+    }
   }
 }
 
diff --git a/modernizr.module b/modernizr.module
index 8359483..478cd3d 100644
--- a/modernizr.module
+++ b/modernizr.module
@@ -138,6 +138,7 @@ function modernizr_get_path() {
   if ($path === NULL) {
     $paths = array();
 
+    // Check for directory specified in hook_libraries_info()
     if (module_exists('libraries')) {
       $library_path = libraries_get_path('modernizr');
       if (file_exists($library_path)) {
@@ -145,13 +146,26 @@ function modernizr_get_path() {
       }
     }
 
+    // Check inside the module folder itself
     $paths[] = drupal_get_path('module', 'modernizr');
 
-    foreach ($paths as $p) {
-      if ($files = file_scan_directory($p, MODERNIZR_FILENAME_REGEX)) {
-        $path = reset($files)->uri;
-        break;
-      }
+    // Scan directories for files
+    $path = _modernizr_scan_for_library($paths);
+  }
+
+  return $path;
+}
+
+/**
+ * Helper function to scan for acceptably named libraries
+ */
+function _modernizr_scan_for_library($paths) {
+  $path = '';
+
+  foreach ($paths as $p) {
+    if ($files = file_scan_directory($p, MODERNIZR_FILENAME_REGEX)) {
+      $path = reset($files)->uri;
+      break;
     }
   }
 
