diff --git a/planetstack/observer/steps/sync_image_deployments.py b/planetstack/observer/steps/sync_image_deployments.py
index 31556c3..3522eca 100644
--- a/planetstack/observer/steps/sync_image_deployments.py
+++ b/planetstack/observer/steps/sync_image_deployments.py
@@ -41,10 +41,20 @@
         if glance_image:
             image_deployment.glance_image_id = glance_image['id']
         elif image_deployment.image.path:
+            image = {
+                'name': image_deployment.image.name,
+                'is_public': True,
+                'disk_format': 'raw', 
+                'container_format': 'bare',
+                'file': image_deployment.image.path, 
+            }  
             glance_image = driver.shell.glanceclient.images.create(name=image_deployment.image.name,
                                                                    is_public=True,
                                                                    disk_format='raw',
                                                                    container_format='bare')
             glance_image.update(data=open(image_deployment.image.path, 'rb'))
-            image_deployment.glance_image_id = glance_image.id
+ 
+            if not glance_image or not glance_image.get('id'): 
+                raise Exception, "Add image failed at deployment %s" % image_deployment.deployment.name
+            image_deployment.glance_image_id = glance_image['id']
         image_deployment.save()
diff --git a/planetstack/observer/steps/sync_roles.py b/planetstack/observer/steps/sync_roles.py
index 5dc30d9..ca85d57 100644
--- a/planetstack/observer/steps/sync_roles.py
+++ b/planetstack/observer/steps/sync_roles.py
@@ -6,7 +6,7 @@
 from core.models.role import Role
 from core.models.site import SiteRole
 from core.models.slice import SliceRole
-from core.models.deployment import DeploymentRole
+from core.models.deployment import Deployment, DeploymentRole
 
 class SyncRoles(OpenStackSyncStep):
     provides=[Role]
@@ -31,7 +31,8 @@
     def sync_record(self, role):
         if not role.enacted:
             deployments = Deployment.objects.all()
-            for deployment in deployments:
+       	    for deployment in deployments:
                 driver = self.driver.admin_driver(deployment=deployment.name)
                 driver.create_role(role.role)
-            role.save()    
+            role.save()
+    
diff --git a/planetstack/observer/steps/sync_slice_deployments.py b/planetstack/observer/steps/sync_slice_deployments.py
index 580edd1..b40eb6b 100644
--- a/planetstack/observer/steps/sync_slice_deployments.py
+++ b/planetstack/observer/steps/sync_slice_deployments.py
@@ -100,8 +100,7 @@
 
         if slice_deployment.tenant_id:
             # update slice/tenant quota
-            driver = self.driver.client_driver(deployment=slice_deployment.deployment.name,
-                                              tenant=slice_deployment.slice.name)
+            driver = self.driver.client_driver(deployment=slice_deployment.deployment.name, tenant=slice_deployment.slice.name)
             driver.shell.nova.quotas.update(tenant_id=slice_deployment.tenant_id, instances=int(slice_deployment.slice.max_slivers)) 
 
         slice_deployment.save()
diff --git a/planetstack/observer/steps/sync_slice_memberships.py b/planetstack/observer/steps/sync_slice_memberships.py
index b6b1638..38bd26c 100644
--- a/planetstack/observer/steps/sync_slice_memberships.py
+++ b/planetstack/observer/steps/sync_slice_memberships.py
@@ -5,6 +5,9 @@
 from observer.openstacksyncstep import OpenStackSyncStep
 from core.models.slice import *
 from core.models.user import UserDeployments
+from util.logger import Logger, logging
+
+logger = Logger(level=logging.INFO)
 
 class SyncSliceMemberships(OpenStackSyncStep):
     requested_interval=0
@@ -15,6 +18,7 @@
 
     def sync_record(self, slice_memb):
         # sync slice memberships at all slice deployments 
+        logger.info("syncing slice privilege: %s %s" % (slice_memb.slice.name, slice_memb.user.email))
         slice_deployments = SliceDeployments.objects.filter(slice=slice_memb.slice)
         for slice_deployment in slice_deployments:
             if not slice_deployment.tenant_id:
diff --git a/planetstack/observer/steps/sync_slivers.py b/planetstack/observer/steps/sync_slivers.py
index b576bbc..a794ccf 100644
--- a/planetstack/observer/steps/sync_slivers.py
+++ b/planetstack/observer/steps/sync_slivers.py
@@ -4,7 +4,7 @@
 from planetstack.config import Config
 from observer.openstacksyncstep import OpenStackSyncStep
 from core.models.sliver import Sliver
-from core.models.slice import SlicePrivilege, SliceDeployments
+from core.models.slice import Slice, SlicePrivilege, SliceDeployments
 from core.models.network import Network, NetworkSlice, NetworkDeployments
 from util.logger import Logger, logging
 
@@ -52,6 +52,7 @@
             # now include network template
             network_templates = [network.template.sharedNetworkName for network in networks \
                                  if network.template.sharedNetworkName]
+            #logger.info("%s %s %s %s" % (driver.shell.quantum.username, driver.shell.quantum.password, driver.shell.quantum.tenant, driver.shell.quantum.url))
             for net in driver.shell.quantum.list_networks()['networks']:
                 if net['name'] in network_templates: 
                     nics.append({'net-id': net['id']}) 
diff --git a/planetstack/observer/sync_image_deployments.py b/planetstack/observer/sync_image_deployments.py
deleted file mode 100644
index 3522eca..0000000
--- a/planetstack/observer/sync_image_deployments.py
+++ /dev/null
@@ -1,60 +0,0 @@
-import os
-import base64
-from collections import defaultdict
-from django.db.models import F, Q
-from planetstack.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.deployment import Deployment
-from core.models.image import Image, ImageDeployments
-
-class SyncImageDeployments(OpenStackSyncStep):
-    provides=[ImageDeployments]
-    requested_interval=0
-
-    def fetch_pending(self):
-        # ensure images are available across all deployments
-        image_deployments = ImageDeployments.objects.all()
-        image_deploy_lookup = defaultdict(list)
-        for image_deployment in image_deployments:
-            image_deploy_lookup[image_deployment.image].append(image_deployment.deployment)
-        
-        all_deployments = Deployment.objects.all() 
-        for image in Image.objects.all():
-            expected_deployments = all_deployments
-            for expected_deployment in expected_deployments:
-                if image not in image_deploy_lookup or \
-                  expected_deployment not in image_deploy_lookup[image]:
-                    id = ImageDeployments(image=image, deployment=expected_deployment)
-                    id.save()
-            
-        # now we return all images that need to be enacted
-        return ImageDeployments.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None)) 
-                      
-    def sync_record(self, image_deployment):
-        driver = self.driver.admin_driver(deployment=image_deployment.deployment.name)
-        images = driver.shell.glance.get_images()
-        glance_image = None
-        for image in images:
-            if image['name'] == image_deployment.image.name:
-                glance_image = image
-                break
-        if glance_image:
-            image_deployment.glance_image_id = glance_image['id']
-        elif image_deployment.image.path:
-            image = {
-                'name': image_deployment.image.name,
-                'is_public': True,
-                'disk_format': 'raw', 
-                'container_format': 'bare',
-                'file': image_deployment.image.path, 
-            }  
-            glance_image = driver.shell.glanceclient.images.create(name=image_deployment.image.name,
-                                                                   is_public=True,
-                                                                   disk_format='raw',
-                                                                   container_format='bare')
-            glance_image.update(data=open(image_deployment.image.path, 'rb'))
- 
-            if not glance_image or not glance_image.get('id'): 
-                raise Exception, "Add image failed at deployment %s" % image_deployment.deployment.name
-            image_deployment.glance_image_id = glance_image['id']
-        image_deployment.save()
diff --git a/planetstack/observer/sync_roles.py b/planetstack/observer/sync_roles.py
deleted file mode 100644
index ca85d57..0000000
--- a/planetstack/observer/sync_roles.py
+++ /dev/null
@@ -1,38 +0,0 @@
-import os
-import base64
-from django.db.models import F, Q
-from planetstack.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.role import Role
-from core.models.site import SiteRole
-from core.models.slice import SliceRole
-from core.models.deployment import Deployment, DeploymentRole
-
-class SyncRoles(OpenStackSyncStep):
-    provides=[Role]
-    requested_interval=0
-
-    def fetch_pending(self):
-        site_roles = SiteRole.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
-        slice_roles = SliceRole.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
-        deployment_roles = DeploymentRole.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
-
-        roles = []
-        for site_role in site_roles:
-            roles.append(site_role)
-        for slice_role in slice_roles:
-            roles.append(slice_role)
-        for deployment_role in deployment_roles:
-            roles.append(deployment_role)
-
-        return roles
-
-
-    def sync_record(self, role):
-        if not role.enacted:
-            deployments = Deployment.objects.all()
-       	    for deployment in deployments:
-                driver = self.driver.admin_driver(deployment=deployment.name)
-                driver.create_role(role.role)
-            role.save()
-    
diff --git a/planetstack/observer/sync_slice_deployments.py b/planetstack/observer/sync_slice_deployments.py
deleted file mode 100644
index b40eb6b..0000000
--- a/planetstack/observer/sync_slice_deployments.py
+++ /dev/null
@@ -1,106 +0,0 @@
-import os
-import base64
-from collections import defaultdict
-from netaddr import IPAddress, IPNetwork
-from django.db.models import F, Q
-from planetstack.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.deployment import Deployment
-from core.models.site import SiteDeployments
-from core.models.slice import Slice, SliceDeployments
-from core.models.user import UserDeployments
-from util.logger import Logger, logging
-
-logger = Logger(level=logging.INFO)
-
-class SyncSliceDeployments(OpenStackSyncStep):
-    provides=[SliceDeployments]
-    requested_interval=0
-
-    def fetch_pending(self):
-        # slice deployments are not visible to users. We must ensure
-        # slices are deployed at all deploymets available to their site.
-        site_deployments = SiteDeployments.objects.all()
-        site_deploy_lookup = defaultdict(list)
-        for site_deployment in site_deployments:
-            site_deploy_lookup[site_deployment.site].append(site_deployment.deployment)
-        
-        slice_deployments = SliceDeployments.objects.all()
-        slice_deploy_lookup = defaultdict(list)
-        for slice_deployment in slice_deployments:
-            slice_deploy_lookup[slice_deployment.slice].append(slice_deployment.deployment)
-        
-        all_deployments = Deployment.objects.all() 
-        for slice in Slice.objects.all():
-            # slices are added to all deployments for now
-            expected_deployments = all_deployments
-            #expected_deployments = site_deploy_lookup[slice.site]
-            for expected_deployment in expected_deployments:
-                if slice not in slice_deploy_lookup or \
-                   expected_deployment not in slice_deploy_lookup[slice]:
-                    sd = SliceDeployments(slice=slice, deployment=expected_deployment)
-                    sd.save()
-
-        # now we can return all slice deployments that need to be enacted   
-        return SliceDeployments.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
-
-    def get_next_subnet(self, deployment=None):
-        # limit ourself to 10.0.x.x for now
-        valid_subnet = lambda net: net.startswith('10.0')
-        driver = self.driver.admin_driver(deployment=deployment)
-        subnets = driver.shell.quantum.list_subnets()['subnets']
-        ints = [int(IPNetwork(subnet['cidr']).ip) for subnet in subnets \
-                if valid_subnet(subnet['cidr'])]
-        ints.sort()
-        if ints:
-            last_ip = IPAddress(ints[-1])
-        else:
-            last_ip = IPAddress('10.0.0.1')
-        last_ip = IPAddress(ints[-1])
-        last_network = IPNetwork(str(last_ip) + "/24")
-        next_network = IPNetwork(str(IPAddress(last_network) + last_network.size) + "/24")
-        return next_network
-
-
-    def sync_record(self, slice_deployment):
-        logger.info("sync'ing slice deployment %s" % slice_deployment)
-        if not slice_deployment.tenant_id:
-            nova_fields = {'tenant_name': slice_deployment.slice.name,
-                   'description': slice_deployment.slice.description,
-                   'enabled': slice_deployment.slice.enabled}
-            driver = self.driver.admin_driver(deployment=slice_deployment.deployment.name)
-            tenant = driver.create_tenant(**nova_fields)
-            slice_deployment.tenant_id = tenant.id
-
-            # XXX give caller an admin role at the tenant they've created
-            deployment_users = UserDeployments.objects.filter(user=slice_deployment.slice.creator,
-                                                             deployment=slice_deployment.deployment)            
-            if not deployment_users:
-                logger.info("slice createor %s has not accout at deployment %s" % (slice_deployment.slice.creator, slice_deployment.deployment.name))
-            else:
-                deployment_user = deployment_users[0]
-                # lookup user id at this deployment
-                kuser= driver.shell.keystone.users.find(email=slice_deployment.slice.creator.email)
-
-                # add required roles at the slice's tenant 
-                driver.add_user_role(kuser.id, tenant.id, 'admin')
-                    
-                # refresh credentials using this tenant
-                client_driver = self.driver.client_driver(caller=deployment_user.user,
-                                                          tenant=tenant.name, 
-                                                          deployment=slice_deployment.deployment.name)
-
-
-        if slice_deployment.id and slice_deployment.tenant_id:
-            # update existing tenant
-            driver = self.driver.admin_driver(deployment=slice_deployment.deployment.name)
-            driver.update_tenant(slice_deployment.tenant_id,
-                                 description=slice_deployment.slice.description,
-                                 enabled=slice_deployment.slice.enabled)  
-
-        if slice_deployment.tenant_id:
-            # update slice/tenant quota
-            driver = self.driver.client_driver(deployment=slice_deployment.deployment.name, tenant=slice_deployment.slice.name)
-            driver.shell.nova.quotas.update(tenant_id=slice_deployment.tenant_id, instances=int(slice_deployment.slice.max_slivers)) 
-
-        slice_deployment.save()
diff --git a/planetstack/observer/sync_slice_memberships.py b/planetstack/observer/sync_slice_memberships.py
deleted file mode 100644
index 38bd26c..0000000
--- a/planetstack/observer/sync_slice_memberships.py
+++ /dev/null
@@ -1,33 +0,0 @@
-import os
-import base64
-from django.db.models import F, Q
-from planetstack.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.slice import *
-from core.models.user import UserDeployments
-from util.logger import Logger, logging
-
-logger = Logger(level=logging.INFO)
-
-class SyncSliceMemberships(OpenStackSyncStep):
-    requested_interval=0
-    provides=[SlicePrivilege]
-
-    def fetch_pending(self):
-        return SlicePrivilege.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
-
-    def sync_record(self, slice_memb):
-        # sync slice memberships at all slice deployments 
-        logger.info("syncing slice privilege: %s %s" % (slice_memb.slice.name, slice_memb.user.email))
-        slice_deployments = SliceDeployments.objects.filter(slice=slice_memb.slice)
-        for slice_deployment in slice_deployments:
-            if not slice_deployment.tenant_id:
-                continue
-            user_deployments = UserDeployments.objects.filter(deployment=slice_deployment.deployment,
-                                                              user=slice_memb.user)
-            if user_deployments:
-                kuser_id  = user_deployments[0].kuser_id
-                driver = self.driver.admin_driver(deployment=slice_deployment.deployment.name)
-                driver.add_user_role(kuser_id,
-                                     slice_deployment.tenant_id,
-                                     slice_memb.role.role)
diff --git a/planetstack/observer/sync_slivers.py b/planetstack/observer/sync_slivers.py
deleted file mode 100644
index a794ccf..0000000
--- a/planetstack/observer/sync_slivers.py
+++ /dev/null
@@ -1,92 +0,0 @@
-import os
-import base64
-from django.db.models import F, Q
-from planetstack.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.sliver import Sliver
-from core.models.slice import Slice, SlicePrivilege, SliceDeployments
-from core.models.network import Network, NetworkSlice, NetworkDeployments
-from util.logger import Logger, logging
-
-logger = Logger(level=logging.INFO)
-
-class SyncSlivers(OpenStackSyncStep):
-    provides=[Sliver]
-    requested_interval=0
-
-    def fetch_pending(self):
-        return Sliver.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
-
-    def sync_record(self, sliver):
-        logger.info("sync'ing sliver:%s deployment:%s " % (sliver, sliver.node.deployment))
-        metadata_update = {}
-        if ("numberCores" in sliver.changed_fields):
-            metadata_update["cpu_cores"] = str(sliver.numberCores)
-
-        for tag in sliver.slice.tags.all():
-            if tag.name.startswith("sysctl-"):
-                metadata_update[tag.name] = tag.value
-
-        if not sliver.instance_id:
-            driver = self.driver.client_driver(caller=sliver.creator, tenant=sliver.slice.name, deployment=sliver.deploymentNetwork.name)
-            # public keys
-            slice_memberships = SlicePrivilege.objects.filter(slice=sliver.slice)
-            pubkeys = [sm.user.public_key for sm in slice_memberships if sm.user.public_key]
-            if sliver.creator.public_key:
-                pubkeys.append(sliver.creator.public_key)
-            if sliver.slice.creator.public_key:
-                pubkeys.append(sliver.slice.creator.public_key) 
-            # netowrks
-            # include all networks available to the slice and/or associated network templates
-            nics = []
-            networks = [ns.network for ns in NetworkSlice.objects.filter(slice=sliver.slice)]   
-            network_deployments = NetworkDeployments.objects.filter(network__in=networks, 
-                                                                    deployment=sliver.node.deployment)
-            # Gather private networks first. This includes networks with a template that has
-            # visibility = private and translation = none
-            for network_deployment in network_deployments:
-                if network_deployment.network.template.visibility == 'private' and \
-                   network_deployment.network.template.translation == 'none': 
-                    nics.append({'net-id': network_deployment.net_id})
-    
-            # now include network template
-            network_templates = [network.template.sharedNetworkName for network in networks \
-                                 if network.template.sharedNetworkName]
-            #logger.info("%s %s %s %s" % (driver.shell.quantum.username, driver.shell.quantum.password, driver.shell.quantum.tenant, driver.shell.quantum.url))
-            for net in driver.shell.quantum.list_networks()['networks']:
-                if net['name'] in network_templates: 
-                    nics.append({'net-id': net['id']}) 
-
-            file("/tmp/scott-manager","a").write("slice: %s\nreq: %s\n" % (str(sliver.slice.name), str(nics)))
-         
-            # look up image id
-            deployment_driver = self.driver.admin_driver(deployment=sliver.deploymentNetwork.name)
-            image_id = None
-            images = deployment_driver.shell.glance.get_images()
-            for image in images:
-                if image['name'] == sliver.image.name:
-                    image_id = image['id']
-                    
-            # look up key name at the deployment
-            # create/fetch keypair
-            keyname = None
-            if sliver.creator.public_key:
-                keyname = sliver.creator.email.lower().replace('@', 'AT').replace('.', '') +\
-                          sliver.slice.name
-                key_fields =  {'name': keyname,
-                               'public_key': sliver.creator.public_key}
-                driver.create_keypair(**key_fields)       
- 
-            instance = driver.spawn_instance(name=sliver.name,
-                                key_name = keyname,
-                                image_id = image_id,
-                                hostname = sliver.node.name,
-                                pubkeys = pubkeys,
-                                nics = nics )
-            sliver.instance_id = instance.id
-            sliver.instance_name = getattr(instance, 'OS-EXT-SRV-ATTR:instance_name')
-            sliver.save()    
-
-        if sliver.instance_id and metadata_update:
-            driver.update_instance_metadata(sliver.instance_id, metadata_update)
-
