diff --git a/README.md b/README.md
index 9f0697f..fd16422 100644
--- a/README.md
+++ b/README.md
@@ -17,3 +17,55 @@ Installation
 3. Install this module.
 4. [Configure your endpoint, it's resources and authentication, normally](http://drupal.org/node/736522).
 5. Optionally, test your rest server using the included bash script, `hosting_services.rest_test.sh`
+
+
+Examples
+------------
+
+1. OAuth Call to list sites
+
+//Your Application key and secret
+$conskey = 'XXXXXXX';
+$conssec = 'XXXXXXXX';
+
+//Your Application URL
+$api_url = 'http://aegir-server.local/aegir/hosting_site';
+
+try {
+  $oauth=new OAuth($conskey,$conssec,OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_URI);
+  $oauth->enableDebug();
+
+  $oauth->fetch("$api_url.json");
+  $sites = json_decode($oauth->getLastResponse());
+  return $sites;
+
+} catch(OAuthException $E) {
+  return $E;
+}
+
+2. OAuth Call to enable a specific site
+
+$conskey = 'dAnm6VqYz6gCUHzF7ncEntfBSLFUcSvY';
+$conssec = 'u8Lz3nukojWkJGuC4cgQuqvQA26rGpxB';
+
+$consumer = new OAuthConsumer($conskey, $conssec, NULL);
+$api_url = 'http://aegir3-dev.aegir3.local/aegir/hosting_site/enable';
+$params = array('type' => 'enable');
+$request = OAuthRequest::from_consumer_and_token($consumer, NULL, 'POST', $api_url, $params);
+$request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL);
+$p = array('nid' => 'XXX');
+$data = http_build_query($p, '', '&');
+$options = array(
+  'headers' => array(
+    'Accept' => 'application/json',
+  ),
+  'method' => 'POST',
+  'data' => $data
+);
+
+$response = drupal_http_request($request->to_url(), $options);
+
+if($response->code == 200){
+  $enable_task = json_decode($response->data);
+}
+
diff --git a/hosting_services.client.inc b/hosting_services.client.inc
index 30ca5b1..5fea388 100644
--- a/hosting_services.client.inc
+++ b/hosting_services.client.inc
@@ -1,4 +1,4 @@
-<?php 
+<?php
 
 /**
  * Perform client.sites
@@ -9,34 +9,34 @@
 function hosting_services_client_sites($id = ''){
   $client = hosting_get_client($id);
   if($client && !empty($client)){
-    $site_list_qry = db_query("SELECT * FROM {hosting_site} WHERE client = %d", $client->nid);
+    $siteList = db_query("SELECT * FROM {hosting_site} WHERE client = :nid", array(':nid' => $client->nid))->fetchAll();
     $sites = array();
-    while($site = db_fetch_object($site_list_qry) ){
-      $sites[] = node_load(array('nid' => $site->nid ));       
+    foreach($siteList as $site){
+      $sites[] = node_load($site->nid);
     }
     return $sites;
-  } 
+  }
   else {
     // Client does not exist in the system
     return false;
-  }    
+  }
 }
 
 /**
- * Check to make sure the user has the right to do things to this client 
+ * Check to make sure the user has the right to do things to this client
  *
  * @param $name
  *   The client name or nid
- */ 
-function hosting_services_client_access($name) { 
+ */
+function hosting_services_client_access($name) {
   global $user;
   $client = hosting_get_client($name);
-  if ($client && (user_access('administer clients') || array_key_exists($client->nid, hosting_get_client_from_user($user->uid)))) { 
-    return TRUE; 
-  } 
-  else { 
-    return FALSE; 
-  } 
+  if ($client && (user_access('administer clients') || array_key_exists($client->nid, hosting_get_client_from_user($user->uid)))) {
+    return TRUE;
+  }
+  else {
+    return FALSE;
+  }
 }
 
 /**
@@ -53,12 +53,14 @@ function hosting_services_client_save($name, $data = NULL){
 
     $client->type = 'client';
     $client->title = $name;
+    $client->uname = hosting_client_sanitize($name);
     $client->uid = ($user->uid) ? $user->uid : NULL;
     $client->name = ($user->name) ? $user->name : NULL;
 
     // Make sure the client title is unique
-    if ($suggestion = hosting_client_validate_suggest($client)) {
-      $client->title = $suggestion;
+    $check = db_query("SELECT nid FROM {hosting_client} WHERE uname LIKE ':name'", array(':name' => addcslashes($client->uname, '\%_')))->fetchField();
+    if ($check) {
+      $client->title = hosting_client_validate_suggest($client);
     }
   }
   else {
@@ -71,9 +73,9 @@ function hosting_services_client_save($name, $data = NULL){
 
   // Save the node
   $client->status = 1;
-  $new_client = node_save($client);
+  node_save($client);
 
-  return $new_client;
+  return !empty($client->nid) ? $client : FALSE;
 }
 
 /**
@@ -83,33 +85,31 @@ function hosting_services_client_save($name, $data = NULL){
  *   Client name or nid
  */
 function hosting_services_client_delete($name) {
-  if (!is_numeric($name)) {
-    $client = hosting_get_client($name);
+  $client = hosting_get_client($name)
+    ? hosting_get_client($name)
+    : hosting_get_client_by_uname($name);
+
+  if ($client) {
     node_delete($client->nid);
+    return TRUE;
   }
-  else {
-    node_delete($name);
-  }
+  return FALSE;
 }
 
 /**
  * Suspend client sites
  */
-
 function hosting_services_suspend_client_sites($name){
   $client = hosting_get_client($name);
   if (!$client) {
     return FALSE;
   }
-  $siteList = db_query("SELECT * FROM {hosting_site} WHERE client = %d", $client->nid);
-  $task->type = 'task';
-  $task->task_type = 'disable';
-  
-  while($site = db_fetch_object($siteList)){
-    $task->rid = $site->nid;  
-    node_save($task);
+  $siteList = db_query("SELECT * FROM {hosting_site} WHERE client = :nid", array(':nid' => $client->nid))->fetchAll();
+  $tasks = array();
+  foreach($siteList as $site){
+    $tasks[] = hosting_add_task($site->nid, 'disable');
   }
-  return TRUE;
+  return $tasks;
 }
 
 /**
@@ -120,12 +120,10 @@ function hosting_services_unsuspend_client_sites($name){
   if (!$client) {
     return FALSE;
   }
-  $siteList = db_query("SELECT * FROM {hosting_site} WHERE client = %d", $client->nid);
-  $task->type = 'task';
-  $task->task_type = 'enable';
-  
-  while($site = db_fetch_object($siteList)){
-    $task->rid = $site->nid;  
-    node_save($task);
+  $siteList = db_query("SELECT * FROM {hosting_site} WHERE client = :nid", array(':nid' => $client->nid))->fetchAll();
+  $tasks = array();
+  foreach($siteList as $site){
+    $tasks[] = hosting_add_task($site->nid, 'enable');
   }
+  return $tasks;
 }
diff --git a/hosting_services.info b/hosting_services.info
index 4f1e985..c1a26f8 100644
--- a/hosting_services.info
+++ b/hosting_services.info
@@ -1,9 +1,10 @@
-core = "6.x"
+name = "Aegir Services API"
+description = "Provides Services API (3.x) integration for Hostmaster system."
+core = "7.x"
 dependencies[] = hosting_platform
 dependencies[] = hosting_site
 dependencies[] = services
 dependencies[] = hosting_client
 dependencies[] = hosting_signup
-description = "Provides Services API (3.x) integration for Hostmaster system."
-name = "Aegir Services API"
 package = Hosting
+
diff --git a/hosting_services.install b/hosting_services.install
index c664208..54bef4c 100644
--- a/hosting_services.install
+++ b/hosting_services.install
@@ -1,4 +1,4 @@
-<?php 
+<?php
 
 /**
  * Aegir Services Schema
@@ -17,7 +17,7 @@ function hosting_services_schema(){
       ),
     )
   );
-  
+
   return $schema;
 }
 
@@ -25,7 +25,6 @@ function hosting_services_schema(){
  * Install Hook
  */
 function hosting_services_install() {
-  drupal_install_schema('hosting_services');
   cache_clear_all('services:methods', 'cache');
 }
 
@@ -33,6 +32,5 @@ function hosting_services_install() {
  * Uninstall Hook
  */
 function hosting_services_uninstall() {
-  drupal_uninstall_schema('hosting_services');
   cache_clear_all('services:methods', 'cache');
 }
diff --git a/hosting_services.module b/hosting_services.module
index 6aaca16..8d837dc 100644
--- a/hosting_services.module
+++ b/hosting_services.module
@@ -1,14 +1,58 @@
-<?php 
+<?php
 
 /**
  * Implementation of hook_perm
  */
-function hosting_services_perm(){
-  return array( 
-    'unsuspend client sites', 'suspend client sites', 'get task', 'create task', 
-    'get profile', 'list profiles', 'get platform', 'list platforms',
-    'save site', 'get site'
+function hosting_services_permission(){
+  $tasks = hosting_available_tasks();
+  foreach($tasks as $node_type => $info){
+    foreach($info as $task => $task_info){
+      $perms[$task . ' ' . $node_type] = array(
+        'title' => $task . ' ' . $node_type,
+        'description' => '',
+      );
+    }
+  }
+
+  $perms['unsuspend client sites'] = array(
+    'title' => t('Unsuspend Client Sites'),
+    'description' => t(''),
+  );
+  $perms['suspend client sites'] = array(
+    'title' => t('Suspend Client Sites'),
+    'description' => t(''),
+  );
+  $perms['list profiles'] = array(
+    'title' => t('List Profiles'),
+    'description' => t(''),
+  );
+  $perms['get profile'] = array(
+    'title' => t('Get Profiles'),
+    'description' => t(''),
+  );
+  $perms['list platforms'] = array(
+    'title' => t('List Platforms'),
+    'description' => t(''),
   );
+  $perms['get platform'] = array(
+    'title' => t('Get Platform'),
+    'description' => t(''),
+  );
+  $perms['get site'] = array(
+    'title' => t('Get Site'),
+    'description' => t(''),
+  );
+  $perms['save site'] = array(
+    'title' => t('Save Site'),
+    'description' => t(''),
+  );
+  $perms['get task'] = array(
+    'title' => t('Get Task'),
+    'description' => t(''),
+  );
+
+  return $perms;
+
 }
 
 /**
@@ -23,7 +67,7 @@ function hosting_services_menu() {
 /**
  * Implementation of hook_resources
  */
-function hosting_services_resources() {
+function hosting_services_services_resources() {
   $resources = array();
 
   // Signup actions
@@ -32,7 +76,7 @@ function hosting_services_resources() {
       'help' => t("Returns the signup form"),
       'callback' => 'hosting_services_signup_form',
       'access arguments' => array('access content'),
-      'file' => array('file' => 'signup.inc', 'module' => 'hosting_services'),
+      'file' => array('type' => 'inc', 'name' => 'hosting_services.signup', 'module' => 'hosting_services'),
     ),
   );
 
@@ -49,7 +93,7 @@ function hosting_services_resources() {
       'callback' => 'hosting_services_profile_get',
       'help' => t('Get a profile and a list of valid platforms'),
       'access arguments' => array('get profile'),
-      'file' => array('file' => 'profile.inc', 'module' => 'hosting_services'),
+      'file' => array('type' => 'inc', 'name' => 'hosting_services.profile', 'module' => 'hosting_services'),
       'args' => array(
         array(
           'name' => 'nid',
@@ -69,7 +113,7 @@ function hosting_services_resources() {
       'callback' => 'hosting_services_platform_list',
       'help' => t('List all available platforms'),
       'access arguments' => array('list platforms'),
-      'file' => array('file' => 'platform.inc', 'module' => 'hosting_services'),
+      'file' => array('type' => 'inc', 'name' => 'hosting_services.platform', 'module' => 'hosting_services'),
       'args' => array(
         array(
           'name' => 'row_count',
@@ -83,7 +127,7 @@ function hosting_services_resources() {
           'type' => 'int',
           'description' => t('Set the offset of rows returned'),
           'optional' => TRUE,
-          'source' => 'param' 
+          'source' => 'param'
         ),
       ),
     ),
@@ -92,7 +136,7 @@ function hosting_services_resources() {
       'callback' => 'hosting_services_platform_get',
       'help' => t('Get a platform'),
       'access arguments' => array('get platform'),
-      'file' => array('file' => 'platform.inc', 'module' => 'hosting_services'),
+      'file' => array('type' => 'inc', 'name' => 'hosting_services.platform', 'module' => 'hosting_services'),
       'args' => array(
         array(
           'name' => 'nid',
@@ -103,6 +147,96 @@ function hosting_services_resources() {
         ),
       ),
     ),
+    'actions' => array(
+      'verify' => array(
+        'callback' => 'hosting_services_platform_task',
+        'help' => t('Verify Platform'),
+        'access arguments' => array("verify platform"),
+        'file' => array('type' => 'inc', 'name' => 'hosting_services.platform', 'module' => 'hosting_services'),
+        'args' => array(
+          array(
+            'name' => 'type',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The type of task'),
+            'source' => array('param' => 'type'),
+          ),
+          array(
+            'name' => 'nid',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The platform node id'),
+            'source' => array('data' => 'nid'),
+          ),
+        ),
+      ),
+      'lock' => array(
+        'callback' => 'hosting_services_platform_task',
+        'help' => t('Lock Platform'),
+        'access arguments' => array("lock platform"),
+        'file' => array('type' => 'inc', 'name' => 'hosting_services.platform', 'module' => 'hosting_services'),
+        'args' => array(
+          array(
+            'name' => 'type',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The type of task'),
+            'source' => array('param' => 'type'),
+          ),
+          array(
+            'name' => 'nid',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The platform node id'),
+            'source' => array('data' => 'nid'),
+          ),
+        ),
+      ),
+      'unlock' => array(
+        'callback' => 'hosting_services_platform_task',
+        'help' => t('Unlock Platform'),
+        'access arguments' => array("unlock platform"),
+        'file' => array('type' => 'inc', 'name' => 'hosting_services.platform', 'module' => 'hosting_services'),
+        'args' => array(
+          array(
+            'name' => 'type',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The type of task'),
+            'source' => array('param' => 'type'),
+          ),
+          array(
+            'name' => 'nid',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The platform node id'),
+            'source' => array('data' => 'nid'),
+          ),
+        ),
+      ),
+      'delete' => array(
+        'callback' => 'hosting_services_platform_task',
+        'help' => t('Delete Plaform'),
+        'access arguments' => array("delete platform"),
+        'file' => array('type' => 'inc', 'name' => 'hosting_services.platform', 'module' => 'hosting_services'),
+        'args' => array(
+          array(
+            'name' => 'type',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The type of task'),
+            'source' => array('param' => 'type'),
+          ),
+          array(
+            'name' => 'nid',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The platform node id'),
+            'source' => array('data' => 'nid'),
+          ),
+        ),
+      ),
+    ),
   );
 
   // Task Services
@@ -116,7 +250,7 @@ function hosting_services_resources() {
       'callback' => 'hosting_services_get_task',
       'help' => t('Fetch an Aegir task'),
       'access arguments' => array('get task'),
-      'file' => array('file' => 'task.inc', 'module' => 'hosting_services'),
+      'file' => array('type' => 'inc', 'name' => 'hosting_services.task', 'module' => 'hosting_services'),
       'args' => array(
         array(
           'name' => 'nid',
@@ -131,7 +265,7 @@ function hosting_services_resources() {
       'callback' => 'hosting_services_save_task',
       'help' => t('Create an aegir task'),
       'access arguments' => array('create task'),
-      'file' => array('file' => 'task.inc', 'module' => 'hosting_services'),
+      'file' => array('type' => 'inc', 'name' => 'hosting_services.task', 'module' => 'hosting_services'),
       'args' => array(
         array(
           'name' => 'nid',
@@ -177,7 +311,7 @@ function hosting_services_resources() {
       'callback' => 'hosting_services_save_task',
       'help' => t('Update an aegir task'),
       'access arguments' => array('create task'),
-      'file' => array('file' => 'task.inc', 'module' => 'hosting_services'),
+      'file' => array('type' => 'inc', 'name' => 'hosting_services.task', 'module' => 'hosting_services'),
       'args' => array(
         array(
           'name' => 'nid',
@@ -225,7 +359,7 @@ function hosting_services_resources() {
       'callback' => 'hosting_services_list_sites',
       'help' => t('List all sites'),
       'access arguments' => array('get site'),
-      'file' => array('file' => 'site.inc', 'module' => 'hosting_services'),
+      'file' => array('type' => 'inc', 'name' => 'hosting_services.site', 'module' => 'hosting_services'),
     ),
     'retrieve' => array(
       'callback' => 'hosting_get_site_by_url',
@@ -245,7 +379,7 @@ function hosting_services_resources() {
       'callback' => 'hosting_services_save_site',
       'help' => t('Create a site'),
       'access arguments' => array('save site'),
-      'file' => array('file' => 'site.inc', 'module' => 'hosting_services'),
+      'file' => array('type' => 'inc', 'name' => 'hosting_services.site', 'module' => 'hosting_services'),
       'args' => array(
         array(
           'name' => 'url',
@@ -267,7 +401,7 @@ function hosting_services_resources() {
       'callback' => 'hosting_services_save_site',
       'help' => t('Update a site'),
       'access arguments' => array('save site'),
-      'file' => array('file' => 'site.inc', 'module' => 'hosting_services'),
+      'file' => array('type' => 'inc', 'name' => 'hosting_services.site', 'module' => 'hosting_services'),
       'args' => array(
         array(
           'name' => 'url',
@@ -285,7 +419,140 @@ function hosting_services_resources() {
         ),
       ),
     ),
-
+    'actions' => array(
+      'verify' => array(
+        'callback' => 'hosting_services_site_task',
+        'help' => t('Verify Site'),
+        'access arguments' => array("verify site"),
+        'file' => array('type' => 'inc', 'name' => 'hosting_services.site', 'module' => 'hosting_services'),
+        'args' => array(
+          array(
+            'name' => 'type',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The type of task'),
+            'source' => array('param' => 'type'),
+          ),
+          array(
+            'name' => 'nid',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The site node id'),
+            'source' => array('data' => 'nid'),
+          ),
+        ),
+      ),
+      'enable' => array(
+        'callback' => 'hosting_services_site_task',
+        'help' => t('Enable Site'),
+        'access arguments' => array("enable site"),
+        'file' => array('type' => 'inc', 'name' => 'hosting_services.site', 'module' => 'hosting_services'),
+        'args' => array(
+          array(
+            'name' => 'type',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The type of task'),
+            'source' => array('param' => 'type'),
+          ),
+          array(
+            'name' => 'nid',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The site node id'),
+            'source' => array('data' => 'nid'),
+          ),
+        ),
+      ),
+      'disable' => array(
+        'callback' => 'hosting_services_site_task',
+        'help' => t('Disable Site'),
+        'access arguments' => array("disable site"),
+        'file' => array('type' => 'inc', 'name' => 'hosting_services.site', 'module' => 'hosting_services'),
+        'args' => array(
+          array(
+            'name' => 'type',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The type of task'),
+            'source' => array('param' => 'type'),
+          ),
+          array(
+            'name' => 'nid',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The site node id'),
+            'source' => array('data' => 'nid'),
+          ),
+        ),
+      ),
+      'backup' => array(
+        'callback' => 'hosting_services_site_task',
+        'help' => t('Backup Site'),
+        'access arguments' => array("backup site"),
+        'file' => array('type' => 'inc', 'name' => 'hosting_services.site', 'module' => 'hosting_services'),
+        'args' => array(
+          array(
+            'name' => 'type',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The type of task'),
+            'source' => array('param' => 'type'),
+          ),
+          array(
+            'name' => 'nid',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The site node id'),
+            'source' => array('data' => 'nid'),
+          ),
+        ),
+      ),
+      'backup-delete' => array(
+        'callback' => 'hosting_services_site_task',
+        'help' => t('Delete Site Backups'),
+        'access arguments' => array("backup-delete site"),
+        'file' => array('type' => 'inc', 'name' => 'hosting_services.site', 'module' => 'hosting_services'),
+        'args' => array(
+          array(
+            'name' => 'type',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The type of task'),
+            'source' => array('param' => 'type'),
+          ),
+          array(
+            'name' => 'nid',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The site node id'),
+            'source' => array('data' => 'nid'),
+          ),
+        ),
+      ),
+      'delete' => array(
+        'callback' => 'hosting_services_site_task',
+        'help' => t('Delete Site'),
+        'access arguments' => array("delete site"),
+        'file' => array('type' => 'inc', 'name' => 'hosting_services.site', 'module' => 'hosting_services'),
+        'args' => array(
+          array(
+            'name' => 'type',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The type of task'),
+            'source' => array('param' => 'type'),
+          ),
+          array(
+            'name' => 'nid',
+            'type' => 'string',
+            'optional' => FALSE,
+            'description' => t('The site node id'),
+            'source' => array('data' => 'nid'),
+          ),
+        ),
+      ),
+    ),
   );
 
   // Client Services
@@ -313,7 +580,7 @@ function hosting_services_resources() {
       'callback' => 'hosting_services_client_save',
       'help' => t('Create a client'),
       'access arguments' => array('create client'),
-      'file' => array('file' => 'client.inc', 'module' => 'hosting_services'),
+      'file' => array('type' => 'inc', 'name' => 'hosting_services.client', 'module' => 'hosting_services'),
       'args' => array(
         array(
           'name' => 'name',
@@ -329,7 +596,7 @@ function hosting_services_resources() {
       'help' => t('Update a client'),
       'access callback' => 'hosting_services_client_access',
       'access arguments append' => TRUE,
-      'file' => array('file' => 'client.inc', 'module' => 'hosting_services'),
+      'file' => array('type' => 'inc', 'name' => 'hosting_services.client', 'module' => 'hosting_services'),
       'args' => array(
         array(
           'name' => 'name',
@@ -352,7 +619,7 @@ function hosting_services_resources() {
       'help' => t('Delete a client'),
       'access callback' => 'hosting_services_client_access',
       'access arguments append' => TRUE,
-      'file' => array('file' => 'client.inc', 'module' => 'hosting_services'),
+      'file' => array('type' => 'inc', 'name' => 'hosting_services.client', 'module' => 'hosting_services'),
       'args' => array(
         array(
           'name' => 'name',
@@ -369,7 +636,7 @@ function hosting_services_resources() {
         'help' => t("Return a list of the client's sites"),
         'callback' => 'hosting_services_client_sites',
         'access arguments' => array('view client'),
-        'file' => array('file' => 'client.inc', 'module' => 'hosting_services'),
+        'file' => array('type' => 'inc', 'name' => 'hosting_services.client', 'module' => 'hosting_services'),
         'args' => array(
           array(
             'name' => 'nid',
@@ -378,14 +645,14 @@ function hosting_services_resources() {
             'description' => t("Nid or unique name of the client"),
             'source' => array('data' => 'name'),
           ),
-        ),    
+        ),
       ),
       // Disable all of a client's sites
       'disable_sites' => array(
         'help' => t('Disable all client sites'),
         'callback' => 'hosting_services_suspend_client_sites',
         'access arguments' => array('suspend client sites'),
-        'file' => array('file' => 'client.inc', 'module' => 'hosting_services'),
+        'file' => array('type' => 'inc', 'name' => 'hosting_services.client', 'module' => 'hosting_services'),
         'args' => array(
           array(
             'name' => 'nid',
@@ -401,7 +668,7 @@ function hosting_services_resources() {
         'help' => t('Enable all client sites'),
         'callback' => 'hosting_services_unsuspend_client_sites',
         'access arguments' => array('unsuspend client sites'),
-        'file' => array('file' => 'client.inc', 'module' => 'hosting_services'),
+        'file' => array('type' => 'inc', 'name' => 'hosting_services.client', 'module' => 'hosting_services'),
         'args' => array(
           array(
             'name' => 'nid',
@@ -419,66 +686,81 @@ function hosting_services_resources() {
 }
 
 /**
- * Implementation of Hook_nodeapi
+ * Implements hook_node_insert().
  */
-function hosting_services_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL){
-
-  switch($node->type){
-    case 'platform':
-      // Lets define if we can create new sites on this platform from remote
-      switch($op){
-        case 'insert':
-          if( $node->remote_site_creation_enabled ){
-            db_query('INSERT INTO {hosting_services_platforms} (vid, nid) VALUES (%d, %d)', $node->vid, $node->nid);
-          }
-          break;
-        case 'update':
-         $data = array(
-           'nid' => $node->nid,
-           'vid' => $node->vid,
-         );
-         $rec_check = db_result(db_query("SELECT COUNT(*) FROM {hosting_services_platforms} WHERE nid = %d AND vid = %d", $node->nid, $node->vid));
-         if ($node->remote_site_creation_enabled && $rec_check) {
-            drupal_write_record('hosting_services_platforms', $data, 'nid');
-          } 
-          else if ($node->remote_site_creation_enabled) {
-            drupal_write_record('hosting_services_platforms', $data);
-          } 
-          else if($node->services_enabled == 0 ){
-            db_query("DELETE FROM {hosting_services_platforms} WHERE nid = %d", $node->nid);
-          }
-          break;
-        case 'delete':
-          db_query('DELETE FROM {hosting_services_platforms} WHERE nid =%d',$node->nid);
-          break;
-        case 'delete_revision':
-          db_query('DELETE FROM {hosting_services_platforms} WHERE vid = %d', $node->vid);
-          break;
-        case 'load':
-          if(db_result(db_query('SELECT COUNT(*) FROM {hosting_services_platforms} 
-          WHERE nid = %d', $node->nid)) > 0){
-            $node->remote_site_creation_enabled = 1;
-          } else {
-            $node->remote_site_creation_enabled = 0;
-          }
-          break;
-        case 'view':
-          break;
+function hosting_services_node_insert($node){
+  if($node->type == 'platform'){
+    if( $node->remote_site_creation_enabled ){
+      db_insert('hosting_services_platforms')
+        ->fields(array(
+          'vid' => $node->vid,
+          'nid' => $node->nid,
+        ))
+        ->execute();
     }
-    break;
+  }
+}
+
+/**
+ * Implements hook_node_update().
+ */
+function hosting_services_node_update($node){
+
+  $data = array(
+    'nid' => $node->nid,
+    'vid' => $node->vid,
+  );
+  $rec_check = db_query("SELECT COUNT(*) FROM {hosting_services_platforms}
+                         WHERE nid = :nid AND vid = :vid",
+                         array(':nid' => $node->nid, ':vid' => $node->vid))->fetchObject();
+  if ($node->remote_site_creation_enabled && $rec_check) {
+    drupal_write_record('hosting_services_platforms', $data, 'nid');
+  }
+  else if ($node->remote_site_creation_enabled) {
+    drupal_write_record('hosting_services_platforms', $data);
+  }
+  else if(isset($node->services_enabled)){
+    db_delete('hosting_services_platforms')
+      ->condition('nid', $node->nid)
+      ->execute();
+  }
+}
+
+/**
+ * Implements hook_node_delete().
+ */
+function hosting_services_node_delete($node){
+  db_delete('hosting_services_platforms')
+    ->condition('nid', $node->nid)
+    ->execute();
 }
+
+/**
+ * Implements hook_node_load().
+ */
+function hosting_services_node_load($nodes){
+  $node = array_shift($nodes);
+  if(db_query('SELECT COUNT(*) FROM {hosting_services_platforms}
+               WHERE nid = :nid', array(':nid' => $node->nid))->fetchField() > 0){
+    $node->remote_site_creation_enabled = 1;
+  }
+  else {
+    $node->remote_site_creation_enabled = 0;
+  }
 }
 
+
 /**
  * Implementation of hook_form_alter
  */
-function hosting_services_form_alter(&$form, &$form_state){
-  if($form['#token'] == 'platform_node_form'){
+function hosting_services_form_alter(&$form, &$form_state, $form_id){
+  if($form_id == 'platform_node_form'){
     $form['remote_site_creation_enabled'] = array(
       '#type' => 'checkbox',
       '#title' => t('Enable this Platform for Remote Site Creation'),
       '#description' => t('Enables a platform to be used when creating sites via services.'),
       '#default_value' => $form['#node']->remote_site_creation_enabled,
     );
-  }   
+  }
 }
+
diff --git a/hosting_services.platform.inc b/hosting_services.platform.inc
index 7b203ad..fcdb033 100644
--- a/hosting_services.platform.inc
+++ b/hosting_services.platform.inc
@@ -1,4 +1,4 @@
-<?php 
+<?php
 
 /**
  * Enables Remote Accessible platform listing
@@ -15,17 +15,32 @@ function hosting_services_platform_list($rows = 0, $offset = 0){
   if ($conditions && is_numeric($offset)) {
     $conditions .= ' OFFSET ' . check_plain($offset);
   }
-  $platform_query = db_query('SELECT n.nid, n.title FROM {node} n INNER JOIN {hosting_services_platforms} hsp ON hsp.nid = n.nid INNER JOIN {hosting_platform} hp ON hp.nid = n.nid WHERE n.type = "platform" AND hp.status = %d' . $conditions, HOSTING_PLATFORM_ENABLED);
-  while($plat = db_fetch_array($platform_query)){
+  $platform_query = db_query('SELECT n.nid, n.title FROM {node} n INNER JOIN {hosting_services_platforms} hsp ON hsp.nid = n.nid INNER JOIN {hosting_platform} hp ON hp.nid = n.nid WHERE n.type = "platform" AND hp.status = :status' . $conditions, array(':status' =>HOSTING_PLATFORM_ENABLED));
+  while($plat = $platform_query->fetchArray()){
     $platforms[] = $plat;
   }
   return $platforms;
 }
- 
+
 /**
  * Returns a specific platform
  */
 function hosting_services_platform_get($nid){
-  $platform = node_load(array('type'=>'platform', 'nid' => $nid)); 
+  $platform = node_load($nid);
   return $platform;
 }
+
+/**
+ * Create tasks
+ */
+function hosting_services_platform_task($type,  $nid) {
+  global $user;
+  $tasks = hosting_available_tasks('platform');
+  if(array_key_exists($type, $tasks)){
+    $task = hosting_add_task($nid, $type);
+    return $task;
+  }
+  else{
+    return FALSE;
+  }
+}
diff --git a/hosting_services.profile.inc b/hosting_services.profile.inc
index 5b1136c..e2a5c5d 100644
--- a/hosting_services.profile.inc
+++ b/hosting_services.profile.inc
@@ -1,9 +1,13 @@
-<?php 
+<?php
 
 /**
  * Returns a single Platform
  */
 function hosting_services_profile_get($profile_id) {
-  $profile = node_load(array('nid' => $profile_id, 'type' => 'package'));
-  return $profile;
+  $output = array(
+    'profile' => node_load($profile_id),
+    'platforms' => hosting_get_profile_platforms($profile_id),
+  );
+
+  return $output;
 }
diff --git a/hosting_services.signup.inc b/hosting_services.signup.inc
index 92235f4..dc8221c 100644
--- a/hosting_services.signup.inc
+++ b/hosting_services.signup.inc
@@ -8,6 +8,6 @@
  * Return the signup form
  */
 function hosting_services_signup_form() {
-  $form = hosting_signup_form();
+  $form = drupal_get_form('hosting_signup_form');
   return $form;
 }
diff --git a/hosting_services.site.inc b/hosting_services.site.inc
index 0901e63..13eb0cb 100644
--- a/hosting_services.site.inc
+++ b/hosting_services.site.inc
@@ -1,12 +1,13 @@
-<?php 
+<?php
 /**
  * List all sites
  */
 function hosting_services_list_sites() {
   $sites = array();
-  $site_result = db_query('SELECT nid, title FROM {node} WHERE type = "site"');
-  while ($row = db_fetch_array($site_result)) {
-    $sites[] = $row;
+  $site_result = db_query('SELECT nid, title FROM {node} WHERE type = :site', array(':site' => 'site'))->fetchAll();
+
+  foreach($site_result as $site) {
+    $sites[] = $site;
   }
   return $sites;
 }
@@ -40,7 +41,23 @@ function hosting_services_save_site($url, $data) {
   node_validate($site);
 
   $site->status = 1;
-  return node_save($site); 
+  node_save($site);
+  return !empty($site->nid) ? $site : FALSE;
+}
+
+/**
+ * Create tasks
+ */
+function hosting_services_site_task($type,  $nid) {
+  global $user;
+  $tasks = hosting_available_tasks('site');
+  if(array_key_exists($type, $tasks)){
+    $task = hosting_add_task($nid, $type);
+    return $task;
+  }
+  else{
+    return FALSE;
+  }
 }
 
 /**
diff --git a/hosting_services.task.inc b/hosting_services.task.inc
index 3ebc85d..9c1f775 100644
--- a/hosting_services.task.inc
+++ b/hosting_services.task.inc
@@ -1,51 +1,54 @@
-<?php 
+<?php
 /**
  * Create or update a task
  */
 function hosting_services_save_task($nid = NULL, $data = NULL, $options = NULL, $rid = NULL, $type = NULL) {
-  global $user;
 
-  $check_nid = db_result(db_query('SELECT type FROM {node} WHERE nid = %d LIMIT 1', $nid));
+  $check_nid = db_query('SELECT type FROM {node} WHERE nid = :nid LIMIT 1', array(':nid' => $nid))->fetchField();
 
   if ($check_nid && $check_nid == 'task') {
     $task = node_load($nid);
     if ($task) {
       $task = (object) array_merge((array) $task, $data);
     }
+    node_save($task);
   }
   else {
     $r_node = node_load($rid);
-
+    $args = array();
     if ($r_node) {
-      $task = new stdClass();
-      $task->type = 'task';
-      $task->task_type = $type;
-      $task->rid = $r_node->nid;
-      $task->task_status = 0;
-      $task->uid = $user->uid;
       switch ($type) {
         case 'clone':
-          $task->task_args = array(
-            'target_platform' => $node->platform,
-            'new_db_server' => $node->db_server,
+          $args = array(
+            'target_platform' => $r_node->platform,
+            'new_db_server' => $r_node->db_server,
             'new_uri' => $options['clone_url'],
           );
           break;
         default:
           break;
       }
+      $task = hosting_add_task($r_node->nid, $type, $args);
     }
   }
+  return $task;
+}
 
-  node_validate($task);
-
-  $task->status=1;
-  return node_save($task);
+function hosting_services_site_task($type,  $nid) {
+  global $user;
+  $tasks = hosting_available_tasks('site');
+  if(array_key_exists($type, $tasks)){
+    $task = hosting_add_task($nid, $type);
+    return $task;
+  }
+  else{
+    return FALSE;
+  }
 }
 
 /**
  * Get task status
  */
 function hosting_services_get_task($nid){
-  return node_load(array('nid' => $nid));    
+  return node_load($nid);
 }
diff --git a/hosting_services_restful/hosting_services_restful.info b/hosting_services_restful/hosting_services_restful.info
index afa181c..9a2be66 100644
--- a/hosting_services_restful/hosting_services_restful.info
+++ b/hosting_services_restful/hosting_services_restful.info
@@ -1,4 +1,7 @@
-core = "6.x"
+name = "Aegir REST Services"
+package = "Hosting"
+project = "hosting_services_restful"
+core = "7.x"
 dependencies[] = "features"
 dependencies[] = "hosting_client"
 dependencies[] = "hosting_services"
@@ -19,7 +22,4 @@ features[user_permission][] = "suspend client sites"
 features[user_permission][] = "unsuspend client sites"
 features[user_permission][] = "view client"
 features[user_role][] = "aegir remote manager (RESTful)"
-name = "Aegir REST Services"
-package = "Hosting"
-project = "hosting_services_restful"
-version = "6.x-1.0-beta2"
+
