diff --git a/og.inc b/og.inc
index 0c7f7b1..3ae8d51 100644
--- a/og.inc
+++ b/og.inc
@@ -90,13 +90,31 @@ class MigrateDestinationOGMembership extends MigrateDestination {
   }
 }
 
+
+
+
 class MigrateGroupFieldHandler extends MigrateFieldHandler {
+
+
+
   public function __construct() {
     $this->registerTypes(array('group'));
   }
 
+  /**
+   * Convert incoming data into the proper field arrays for OG target audience fields.
+   *
+   * @param $entity
+   *  The destination entity which will hold the field arrays.
+   * @param array $field_info
+   *  Metadata for the date field being populated.
+   * @param array $instance
+   *  Metadata for this instance of the date field being populated.
+   * @param array $values
+   *  Array of date values to be fielded.
+   */
   public function prepare($entity, array $field_info, array $instance, array $values) {
-    $migration = Migration::currentMigration();
+    
     if (isset($values['arguments'])) {
       $arguments = $values['arguments'];
       unset($values['arguments']);
@@ -105,18 +123,66 @@ class MigrateGroupFieldHandler extends MigrateFieldHandler {
       $arguments = array();
     }
 
+    $arguments += array(
+      'source_type' => 'name',
+      'state' => 1,
+      'created' => REQUEST_TIME,
+    );
+
     $language = $this->getFieldLanguage($entity, $field_info, $arguments);
 
     // Setup the standard Field API array for saving.
     $delta = 0;
-    $return = array();
-    foreach ($values as $value) {
-      // Don't save empty references
-      if ($value) {
-        $return[$language][$delta]['gid'] = $value;
+    foreach ($values as $group) {
+
+      $gid = FALSE;
+
+      switch ($arguments['source_type']) {
+        case 'name':
+          // Lookup group by name
+          $gid = $this->getGidByName($group);
+          break;
+        case 'gid':
+          // Use gid as group id
+          if (og_load($group)) {
+            $gid = $group;
+          }
+          break;
+      }
+
+      if ($gid) {
+        // Set Group
+        $return[$language][$delta] = array(
+          'gid' => $gid,
+          'state' => $arguments['state'],
+          'created' => $arguments['created'],
+        );
+
         $delta++;
       }
     }
+    if (!isset($return)) {
+      $return = NULL;
+    }
     return $return;
   }
+
+
+  /**
+   * Returns the gid(group id) of the group that matches the given name.
+   * If there are more than one results the id of the last group is returned.
+   *
+   * @param string $name
+   * @return int $gid
+   */
+  protected function getGidByName($name){
+    static $names = NULL;
+    if(is_null($names)){
+      $names = array_flip(og_label_multiple(og_get_all_group()));
+    }
+
+    return isset($names[$name]) ? $names[$name] : FALSE;
+  }
+
+
 }
