diff --git a/commands/core/DrushRole.php b/commands/core/DrushRole.php
new file mode 100644
index 0000000..59ca258
--- /dev/null
+++ b/commands/core/DrushRole.php
@@ -0,0 +1,83 @@
+<?php
+
+abstract class DrushRole {
+  public $name;
+  public $rid;
+  public $roles;
+
+  public function __construct($rid) {
+    $this->roles = user_roles();
+    if (!is_numeric($rid)) {
+      $role_name = $rid;
+      if (in_array($role_name, $this->roles)) {
+        $rid = array_search($role_name, $this->roles);
+      }
+    }
+
+    if (isset($this->roles[$rid])) {
+      $this->rid = $rid;
+      $this->name = $this->roles[$rid];
+    }
+    else {
+      throw new DrushRoleException(dt('Could not find the role: !role', array('!role' => $rid)));
+    }
+  }
+
+  public function getPerms() {
+    $perms = user_role_permissions(array($this->rid => $this->name));
+    return array_keys($perms[$this->rid]);
+  }
+
+  public function getModulePerms($module) {
+    $perms = module_invoke($module, 'permission');
+    return $perms ? array_keys($perms) : array();
+  }
+
+  public function add($perm) {
+    user_role_grant_permissions($this->rid, array($perm));
+    return dt('Added "!perm" to "!role"', array('!perm' => $perm, '!role' => $this->name));
+  }
+
+  public function remove($perm) {
+    return user_role_revoke_permissions($this->rid, array($perm));
+    return dt('Removed "!perm" to "!role"', array('!perm' => $perm, '!role' => $this->name));
+  }
+}
+
+class DrushRole6 extends DrushRole {
+  public $perms = array();
+
+  public function getModulePerms($module) {
+    return module_invoke($module, 'perm');
+  }
+
+  public function add($perm) {
+    $perms = $this->getPerms();
+    if (!in_array($perm, $this->perms)) {
+      $this->perms[] = $perm;
+      $new_perms = implode(", ", $this->perms);
+      db_query("UPDATE {permission} SET perm = '%s' FROM {role} WHERE role.rid = permission.rid AND role.rid= '%d'", $new_perms, $this->rid);
+    }
+    else {
+      drush_print(dt('"!role" already has the permission "!perm"', array(
+        '!perm' => $perm,
+        '!role' => $this->name,
+      )));
+    }
+  }
+
+  public function getPerms() {
+    if (empty($this->perms)) {
+      $perms = db_result(db_query("SELECT perm FROM {permission} pm LEFT JOIN {role} r ON r.rid = pm.rid WHERE r.rid = '%d'", $this->rid));
+      $role_perms = explode(", ", $perms);
+      $this->perms = array_filter($role_perms);
+    }
+    return $this->perms;
+  }
+  public function remove($perm) {
+  }
+}
+
+class DrushRole7 extends DrushRole {}
+
+class DrushRoleException extends Exception {}
diff --git a/commands/core/role.drush.inc b/commands/core/role.drush.inc
new file mode 100644
index 0000000..fd41d4d
--- /dev/null
+++ b/commands/core/role.drush.inc
@@ -0,0 +1,128 @@
+<?php
+
+/**
+ * Implementation of hook_drush_command().
+ */
+function role_drush_command() {
+  $items['role-add-perm'] = array(
+    'description' => '',
+    'arguments' => array(
+      'role' => 'role',
+      'perm' => 'perm',
+    ),
+    'options' => array(
+      'module' => 'List the permissions provided by a specific module.',
+    ),
+    'bootstrap' => DRUSH_BOOTSTRAP_MAX,
+  );
+
+  $items['role-remove-perm'] = array(
+    'description' => '',
+    'arguments' => array(
+      'role' => 'role',
+      'perm' => 'perm',
+    ),
+    'options' => array(
+      'module' => 'List the permissions provided by a specific module.',
+    ),
+    'bootstrap' => DRUSH_BOOTSTRAP_MAX,
+  );
+
+  $items['role-list'] = array(
+    'description' => 'Display a list of roles.',
+    'aliases' => array('rls'),
+    'options' => array(
+      'perm' => 'Perform a search on roles that have a certain permission',
+    ),
+    'examples' => array(
+      "drush role-list --perm='administer nodes'" => 'Display a list of roles that have the administer nodes permission assigned.',
+    ),
+  );
+
+  return $items;
+}
+
+function drush_role_add_perm($rid, $permission = NULL) {
+  drush_role_perm('add', $rid, $permission);
+}
+
+function drush_role_remove_perm($rid, $permission = NULL) {
+  drush_role_perm('remove', $rid, $permission);
+}
+
+function drush_role_perm($action, $rid, $permission = NULL) {
+  require dirname(__FILE__) . '/DrushRole.php';
+  $permissions = array();
+  $role = drush_role_get_class($rid);
+
+  // If a permission wasn't provided, but the module option is specified,
+  // provide a list of permissions provided by that module.
+  if (!$permission && $module = drush_get_option('module', FALSE)) {
+    if (!module_exists($module)) {
+      drush_set_error('DRUSH_ROLE_ERROR', dt('!module not enabled!', array('!module' => $module)));
+      return;
+    }
+
+    $module_perms = $role->getModulePerms($module);
+    $choice = drush_choice($module_perms, "Enter a number to choose which permission to $action.");
+    if ($choice !== FALSE) {
+      $permission = $module_perms[$choice];
+    }
+  }
+  else {
+    foreach (module_list(FALSE, FALSE, TRUE) as $module) {
+      if ($perms = $role->getModulePerms($module)) {
+        $permissions = array_merge($permissions, $perms);
+      }
+    }
+    if (!in_array($permission, $permissions)) {
+      drush_set_error(dt('Could not find the permission: !perm', array('!perm' => $permission)));
+    }
+  }
+
+  $role_perms = $role->getPerms();
+
+  $role->{$action}($permission);
+  drush_print(dt(ucfirst($action) . 'ed "!perm" to "!role"', array('!perm' => $permission, '!role' => $role->name)));
+
+  cache_clear_all();
+}
+
+function drush_role_get_class($role_name) {
+  $version = drush_drupal_major_version();
+  $class = 'DrushRole' . $version;
+  if (class_exists($class)) {
+    $role = new $class($role_name);
+    return $role;
+  }
+  else {
+    drush_set_error('DRUSH_ROLE_ERROR', dt('Drupal %d not supported!', $version));
+  }
+}
+
+/**
+ * Displays a list of roles
+ */
+function drush_role_list() {
+  // get options passed
+  $perm = drush_get_option('perm');
+  $roles = array();
+
+  // get all roles - if $perm is empty user_roles retrieves all roles
+  $roles = user_roles(FALSE, $perm);
+
+  if (!empty($roles)) {
+    $rows[] = array('rid',dt('Name'));
+    foreach($roles as $rid => $name) {
+      $rows[] = array($rid, $name);
+      drush_print_pipe($rid .','. $name ."\n");
+    }
+    $num = count($roles);
+
+    drush_print_table($rows, TRUE);
+  }
+
+  else {
+    drush_set_error('No roles found.');
+  }
+}
diff --git a/examples/sync_enable.drush.inc b/examples/sync_enable.drush.inc
index 0885663..d839e44 100644
--- a/examples/sync_enable.drush.inc
+++ b/examples/sync_enable.drush.inc
@@ -77,25 +77,18 @@ function drush_sync_enable_post_sql_sync($source = NULL, $destination = NULL) {
   }
   $permissions_table = drush_get_option('permission');
   if (!empty($permissions_table)) {
-    foreach ($permissions_table as $role => $actions) {
-      $values = drush_invoke_process($destination, 'sql-query', array("select perm from permission, role where role.name='$role' and role.rid = permission.rid;"), array(), array('integrate' => FALSE));
-      // Remove the first line and explode
-      $sql_output = preg_replace('/^.+\n/', '', trim($values['output']));
-      $permissions = explode(', ', $sql_output);
-      $original_permissions = $permissions;
+    foreach ($permissions_table as $role_name => $actions) {
       if (array_key_exists('add', $actions)) {
         $permissions_to_add = is_array($actions['add']) ? $actions['add'] : explode(', ', $actions['add']);
-        drush_log(dt("Add !permissions to !role post-sql-sync", array('!permissions' => implode(', ', $permissions_to_add), '!role' => $role)), 'ok');
-        $permissions = array_unique(array_merge($permissions, $permissions_to_add));
+        foreach ($permissions_to_add as $permission) {
+          $values = drush_invoke_process($destination, 'role-add-perm', array($role_name, $permission), array(), array('integrate' => TRUE));
+        }
       }
       if (array_key_exists('remove', $actions)) {
         $permissions_to_remove = is_array($actions['remove']) ? $actions['remove'] : explode(', ', $actions['remove']);
-        drush_log(dt("Remove !permissions from !role post-sql-sync", array('!permissions' => implode(', ', $permissions_to_remove), '!role' => $role)), 'ok');
-        $permissions = array_diff($permissions, $permissions_to_remove);
-      }
-      if ($permissions != $original_permissions) {
-        $permissions_string = implode(', ', $permissions);
-        $values = drush_invoke_process($destination, 'sql-query', array("update permission, role set perm='$permissions_string' where role.name='$role' and role.rid = permission.rid;"), array(), array('integrate' => FALSE));
+        foreach ($permissions_to_remove as $permission) {
+          $values = drush_invoke_process($destination, 'role-remove-perm', array($role_name, $permission), array(), array('integrate' => TRUE));
+        }
       }
     }
   }
