diff --git a/libraries.api.php b/libraries.api.php
index 66fa772..bfb0838 100644
--- a/libraries.api.php
+++ b/libraries.api.php
@@ -118,9 +118,12 @@
  *     - $variant: If the $library array belongs to a certain variant (see
  *       above), a string containing the variant name. NULL, otherwise.
  *     Valid callback groups are:
- *     - prepare: Callbacks registered in this group are applied as soon as the
+ *     - info: Callbacks registered in this group are applied as soon as the
  *       library information has been retrieved via hook_libraries_info() or
  *       info files.
+ *     - prepare: Callbacks registered in this group are applied when a library
+ *       is about to be detected, after the library path has been detected and
+ *       before the version callback is invoked.
  *     - detect: Callbacks registered in this group are applied as soon as
  *       library detection has been completed. At this point the library
  *       contains the version-specific information, if specified, and following
diff --git a/libraries.module b/libraries.module
index 9abbcad..0dcb5d0 100644
--- a/libraries.module
+++ b/libraries.module
@@ -246,34 +246,15 @@ function libraries_info($name = NULL) {
 
     // Provide defaults.
     foreach ($libraries as $machine_name => &$properties) {
-      $properties += array(
-        'machine name' => $machine_name,
-        'name' => $machine_name,
-        'vendor url' => '',
-        'download url' => '',
-        'path' => '',
-        'library path' => NULL,
-        'version callback' => 'libraries_get_version',
-        'version arguments' => array(),
-        'files' => array(),
-        'variants' => array(),
-        'versions' => array(),
-        'integration files' => array(),
-        'callbacks' => array(),
-      );
-      $properties['callbacks'] += array(
-        'prepare' => array(),
-        'detect' => array(),
-        'load' => array(),
-      );
+      libraries_info_defaults($properties, $machine_name);
     }
 
     // Allow modules to alter the registered libraries.
     drupal_alter('libraries_info', $libraries);
 
-    // Invoke callbacks in the 'prepare' group.
+    // Invoke callbacks in the 'info' group.
     foreach ($libraries as &$properties) {
-      libraries_invoke('prepare', $properties);
+      libraries_invoke('info', $properties);
     }
   }
 
@@ -284,6 +265,41 @@ function libraries_info($name = NULL) {
 }
 
 /**
+ * Applies default properties to a library definition.
+ *
+ * @param $library
+ *   An array of library information.
+ * @param $machine_name
+ *   The machine name of a library to return registered information
+ *   for, or FALSE if no library with the given name exists. If omitted,
+ *   information about all libraries is returned.
+ */
+function libraries_info_defaults(&$library, $machine_name) {
+  $library += array(
+    'machine name' => $machine_name,
+    'name' => $machine_name,
+    'vendor url' => '',
+    'download url' => '',
+    'path' => '',
+    'library path' => NULL,
+    'version callback' => 'libraries_get_version',
+    'version arguments' => array(),
+    'files' => array(),
+    'variants' => array(),
+    'versions' => array(),
+    'integration files' => array(),
+    'callbacks' => array(),
+  );
+  $library['callbacks'] += array(
+    'info' => array(),
+    'prepare' => array(),
+    'detect' => array(),
+    'load' => array(),
+  );
+  return $library;
+}
+
+/**
  * Tries to detect a library and its installed version.
  *
  * @todo We need to figure out whether, and if, how we want to retain the
@@ -331,6 +347,9 @@ function libraries_detect($name) {
     return $library;
   }
 
+  // Invoke callbacks in the 'prepare' group.
+  libraries_invoke('prepare', $library);
+
   // Detect library version, if not hardcoded.
   if (!isset($library['version'])) {
     // We support both a single parameter, which is an associative array, and an
diff --git a/tests/libraries.test b/tests/libraries.test
index ada68b9..0b6b535 100644
--- a/tests/libraries.test
+++ b/tests/libraries.test
@@ -138,8 +138,7 @@ class LibrariesTestCase extends DrupalWebTestCase {
     $this->assertEqual($library['variants']['example_variant']['installed'], TRUE, 'Existing variant found.');
 
     // Test the applying of callbacks.
-    $expected = array_merge(libraries_info('example_empty'), array(
-      'machine name' => 'example_callback',
+    $expected = array(
       'name' => 'Example callback',
       'library path' => drupal_get_path('module', 'libraries') . '/tests/example',
       'version' => '1',
@@ -147,11 +146,13 @@ class LibrariesTestCase extends DrupalWebTestCase {
         '1' => array(
           'variants' => array(
             'example_variant' => array(
+              'info callback' => 'not applied',
               'prepare callback' => 'not applied',
               'detect callback' => 'not applied',
               'load callback' => 'not applied',
             ),
           ),
+          'info callback' => 'not applied',
           'prepare callback' => 'not applied',
           'detect callback' => 'not applied',
           'load callback' => 'not applied',
@@ -159,57 +160,82 @@ class LibrariesTestCase extends DrupalWebTestCase {
       ),
       'variants' => array(
         'example_variant' => array(
+          'info callback' => 'not applied',
           'prepare callback' => 'not applied',
           'detect callback' => 'not applied',
           'load callback' => 'not applied',
         ),
       ),
       'callbacks' => array(
+        'info' => array('_libraries_test_info_callback'),
         'prepare' => array('_libraries_test_prepare_callback'),
         'detect' => array('_libraries_test_detect_callback'),
         'load' => array('_libraries_test_load_callback'),
       ),
+      'info callback' => 'not applied',
       'prepare callback' => 'not applied',
       'detect callback' => 'not applied',
       'load callback' => 'not applied',
-    ));
-    // Test a callback in the 'prepare' phase.
-    $expected['prepare callback'] = 'applied (top-level)';
-    $expected['versions']['1']['prepare callback'] = 'applied (version 1)';
-    $expected['versions']['1']['variants']['example_variant']['prepare callback'] = 'applied (version 1, variant example_variant)';
-    $expected['variants']['example_variant']['prepare callback'] = 'applied (variant example_variant)';
+      'module' => 'libraries_test',
+    );
+    libraries_info_defaults($expected, 'example_callback');
+
+    // Test a callback in the 'info' phase.
+    $expected['info callback'] = 'applied (top-level)';
+    $expected['versions']['1']['info callback'] = 'applied (version 1)';
+    $expected['versions']['1']['variants']['example_variant']['info callback'] = 'applied (version 1, variant example_variant)';
+    $expected['variants']['example_variant']['info callback'] = 'applied (variant example_variant)';
+
     $library = libraries_info('example_callback');
-    $this->verbose(var_export($expected, TRUE));
-    $this->verbose(var_export($library, TRUE));
-    $this->assertEqual($library, $expected, 'Prepare callback was applied correctly.');
-    // Test a callback in the 'detect' phase.
+    $this->verbose('Expected:<pre>' . var_export($expected, TRUE) . '</pre>');
+    $this->verbose('Actual:<pre>' . var_export($library, TRUE) . '</pre>');
+    $this->assertEqual($library, $expected, 'Info callback was applied correctly.');
+
+    // Test a callback in the 'prepare' and 'detect' phases.
+    // Successfully detected libraries should only contain version information
+    // for the detected version and thus, be marked as installed.
     unset($expected['versions']);
     $expected['installed'] = TRUE;
+
+    // Additionally, version-specific properties of the detected version are
+    // supposed to override the corresponding top-level properties.
+    $expected['info callback'] = 'applied (version 1)';
     $expected['prepare callback'] = 'applied (version 1)';
+    $expected['detect callback'] = 'applied (top-level)';
     $expected['variants']['example_variant']['installed'] = TRUE;
+    $expected['variants']['example_variant']['info callback'] = 'applied (version 1, variant example_variant)';
     $expected['variants']['example_variant']['prepare callback'] = 'applied (version 1, variant example_variant)';
-    $expected['detect callback'] = 'applied (top-level)';
     $expected['variants']['example_variant']['detect callback'] = 'applied (variant example_variant)';
+
     $library = libraries_detect('example_callback');
-    $this->verbose(var_export($expected, TRUE));
-    $this->verbose(var_export($library, TRUE));
-    $this->assertEqual($library, $expected, 'Detect callback was applied correctly.');
+    $this->verbose('Expected:<pre>' . var_export($expected, TRUE) . '</pre>');
+    $this->verbose('Actual:<pre>' . var_export($library, TRUE) . '</pre>');
+    $this->assertEqual($library, $expected, 'Prepare and detect callbacks were applied correctly.');
 
     // Test a callback in the 'load' phase.
+    // Successfully loaded libraries should only contain information about the
+    // already loaded variant.
     unset($expected['variants']);
     $expected['loaded'] = 0;
     $expected['load callback'] = 'applied (top-level)';
+
     $library = libraries_load('example_callback');
-    $this->verbose(var_export($expected, TRUE));
-    $this->verbose(var_export($library, TRUE));
+    $this->verbose('Expected:<pre>' . var_export($expected, TRUE) . '</pre>');
+    $this->verbose('Actual:<pre>' . var_export($library, TRUE) . '</pre>');
     $this->assertEqual($library, $expected, 'Load callback was applied correctly.');
+
     // This is not recommended usually and is only used for testing purposes.
     drupal_static_reset('libraries_load');
+
+    // Successfully loaded library variants are supposed to contain the specific
+    // variant information only.
+    $expected['info callback'] = 'applied (version 1, variant example_variant)';
     $expected['prepare callback'] = 'applied (version 1, variant example_variant)';
     $expected['detect callback'] = 'applied (variant example_variant)';
+
     $library = libraries_load('example_callback', 'example_variant');
-    $this->verbose(var_export($expected, TRUE));
-    $this->verbose(var_export($library, TRUE));
+    $this->verbose('Expected:<pre>' . var_export($expected, TRUE) . '</pre>');
+    $this->verbose('Actual:<pre>' . var_export($library, TRUE) . '</pre>');
     $this->assertEqual($library, $expected, 'Load callback was applied correctly to a variant.');
 
     // Test loading of a simple library with a top-level files property.
diff --git a/tests/libraries_test.module b/tests/libraries_test.module
index bf1369f..0aca113 100644
--- a/tests/libraries_test.module
+++ b/tests/libraries_test.module
@@ -210,12 +210,14 @@ function libraries_test_libraries_info() {
         'variants' => array(
           'example_variant' => array(
             // These keys are for testing purposes only.
+            'info callback' => 'not applied',
             'prepare callback' => 'not applied',
             'detect callback' => 'not applied',
             'load callback' => 'not applied',
           ),
         ),
         // These keys are for testing purposes only.
+        'info callback' => 'not applied',
         'prepare callback' => 'not applied',
         'detect callback' => 'not applied',
         'load callback' => 'not applied',
@@ -224,17 +226,20 @@ function libraries_test_libraries_info() {
     'variants' => array(
       'example_variant' => array(
         // These keys are for testing purposes only.
+        'info callback' => 'not applied',
         'prepare callback' => 'not applied',
         'detect callback' => 'not applied',
         'load callback' => 'not applied',
       ),
     ),
     'callbacks' => array(
+      'info' => array('_libraries_test_info_callback'),
       'prepare' => array('_libraries_test_prepare_callback'),
       'detect' => array('_libraries_test_detect_callback'),
       'load' => array('_libraries_test_load_callback'),
     ),
     // These keys are for testing purposes only.
+    'info callback' => 'not applied',
     'prepare callback' => 'not applied',
     'detect callback' => 'not applied',
     'load callback' => 'not applied',
@@ -330,15 +335,16 @@ function _libraries_test_return_installed($library, $name, $installed) {
  *
  * This function is used as a test callback for the 'prepare' callback group.
  *
- * @param $library
- *   An array of library information, which may be version- or variant-specific.
- *   Passed by reference.
- * @param $version
- *   The version the library information passed in $library belongs to, or NULL
- *   if the passed library information is not version-specific.
- * @param $variant
- *   The variant the library information passed in $library belongs to, or NULL
- *   if the passed library information is not variant-specific.
+ * @see _libraries_test_callback()
+ */
+function _libraries_test_info_callback(&$library, $version, $variant) {
+  _libraries_test_callback($library, $version, $variant, 'info');
+}
+
+/**
+ * Sets the 'prepare callback' key.
+ *
+ * This function is used as a test callback for the 'prepare' callback group.
  *
  * @see _libraries_test_callback()
  */
@@ -351,16 +357,6 @@ function _libraries_test_prepare_callback(&$library, $version, $variant) {
  *
  * This function is used as a test callback for the 'detect' callback group.
  *
- * @param $library
- *   An array of library information, which may be version- or variant-specific.
- *   Passed by reference.
- * @param $version
- *   The version the library information passed in $library belongs to, or NULL
- *   if the passed library information is not version-specific.
- * @param $variant
- *   The variant the library information passed in $library belongs to, or NULL
- *   if the passed library information is not variant-specific.
- *
  * @see _libraries_test_callback()
  */
 function _libraries_test_detect_callback(&$library, $version, $variant) {
@@ -372,16 +368,6 @@ function _libraries_test_detect_callback(&$library, $version, $variant) {
  *
  * This function is used as a test callback for the 'load' callback group.
  *
- * @param $library
- *   An array of library information, which may be version- or variant-specific.
- *   Passed by reference.
- * @param $version
- *   The version the library information passed in $library belongs to, or NULL
- *   if the passed library information is not version-specific.
- * @param $variant
- *   The variant the library information passed in $library belongs to, or NULL
- *   if the passed library information is not variant-specific.
- *
  * @see _libraries_test_callback()
  */
 function _libraries_test_load_callback(&$library, $version, $variant) {
