diff --git a/xos/synchronizer/Dockerfile.synchronizer b/xos/synchronizer/Dockerfile.synchronizer
index b0c967c..cd4da41 100644
--- a/xos/synchronizer/Dockerfile.synchronizer
+++ b/xos/synchronizer/Dockerfile.synchronizer
@@ -55,5 +55,5 @@
       org.opencord.component.xos.vcs-url=$org_opencord_component_xos_vcs_url \
       org.opencord.component.xos.vcs-ref=$org_opencord_component_xos_vcs_ref
 
-CMD bash -c "service filebeat start; cd /opt/xos/synchronizers/progran; ./run.sh"
+CMD bash -c "service filebeat start; cd /opt/xos/synchronizers/progran; python progran-synchronizer.py"
 
diff --git a/xos/synchronizer/run.sh b/xos/synchronizer/run.sh
deleted file mode 100755
index 63c8460..0000000
--- a/xos/synchronizer/run.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-python progran-synchronizer.py
diff --git a/xos/synchronizer/steps/.gitignore b/xos/synchronizer/steps/.gitignore
new file mode 100644
index 0000000..c649235
--- /dev/null
+++ b/xos/synchronizer/steps/.gitignore
@@ -0,0 +1 @@
+synchronizers
\ No newline at end of file
diff --git a/xos/synchronizer/steps/helpers.py b/xos/synchronizer/steps/helpers.py
index d52422b..8f07a66 100644
--- a/xos/synchronizer/steps/helpers.py
+++ b/xos/synchronizer/steps/helpers.py
@@ -15,6 +15,8 @@
 from xosconfig import Config
 from multistructlog import create_logger
 from synchronizers.new_base.modelaccessor import ProgranService
+import time
+import datetime
 
 log = create_logger(Config().get('logging'))
 
@@ -30,7 +32,7 @@
         try:
             progran_service = ProgranService.objects.all()[0]
         except IndexError:
-            log.error("Cannot find Progran Service, does it exists?")
+            raise Exception("Cannot find Progran Service, does it exists?")
         return ProgranHelpers.get_onos_info_from_service(progran_service)
 
     @staticmethod
@@ -41,3 +43,43 @@
             'username': progran_service.onos_username,
             'password': progran_service.onos_password,
         }
+
+    @staticmethod
+    def get_progran_rest_errors(res):
+        res = res.json()
+        if res['Result'] == -2:
+            raise Exception(res['ErrCode'])
+
+    @staticmethod
+    def date_to_time(d):
+        if len(d) == 0:
+            return 0
+        return time.mktime(datetime.datetime.strptime(d, "%d.%m.%Y %H:%S").timetuple())
+
+    @staticmethod
+    def update_fields(model, dict, mapping={}, transformations={}):
+        dict = ProgranHelpers.convert_keys(dict, mapping, transformations)
+        for k, v in dict.iteritems():
+            if hasattr(model, k):
+                setattr(model, k, v)
+            else:
+                log.warn("%s does not have a '%s' property, not updating it" % (model.model_name, k))
+        return model
+
+    @staticmethod
+    def convert_keys(dict, mapping={}, transformations={}):
+        for k, v in dict.iteritems():
+            if k in mapping:
+                # apply custom transformations to the data
+                if k in transformations:
+                    dict[k] = transformations[k](v)
+
+                # NOTE we may have different names that the field in the dict
+                dict[mapping[k]] = dict[k]
+                del dict[k]
+        return dict
+
+    @staticmethod
+    def list_diff(first, second):
+        second = set(second)
+        return [item for item in first if item not in second]
\ No newline at end of file
diff --git a/xos/synchronizer/steps/sync_imsi.py b/xos/synchronizer/steps/sync_imsi.py
index c76dafb..93af41f 100644
--- a/xos/synchronizer/steps/sync_imsi.py
+++ b/xos/synchronizer/steps/sync_imsi.py
@@ -78,6 +78,7 @@
         self.run_playbook(o, create_fields)
 
         # fetch the IMSI we just created
+        # NOTE we won't need this method once we'll have polling in place
         imsi_url = "http://%s:%s/onos/progran/imsi/%s" % (base_fields['onos_url'], base_fields['onos_port'], o.imsi_number)
         r = requests.get(imsi_url)
         o.ue_status = r.json()['ImsiArray'][0]['UeStatus']
diff --git a/xos/synchronizer/steps/sync_progranserviceinstance.py b/xos/synchronizer/steps/sync_progranserviceinstance.py
index 14925bc..11d679d 100644
--- a/xos/synchronizer/steps/sync_progranserviceinstance.py
+++ b/xos/synchronizer/steps/sync_progranserviceinstance.py
@@ -17,14 +17,15 @@
 import os
 import sys
 from synchronizers.new_base.SyncInstanceUsingAnsible import SyncStep
-from synchronizers.new_base.ansible_helper import run_template
-from synchronizers.new_base.modelaccessor import ProgranServiceInstance, ENodeB
+from synchronizers.new_base.modelaccessor import ProgranServiceInstance, ENodeB, Handover
 
 from xosconfig import Config
 from multistructlog import create_logger
 import json
 import requests
 from requests.auth import HTTPBasicAuth
+import time
+import datetime
 
 
 log = create_logger(Config().get('logging'))
@@ -39,6 +40,9 @@
 
     observes = ProgranServiceInstance
 
+    # Poll every 5 loops of self.call
+    poll = 0
+
     def sync_record(self, o):
         onos = ProgranHelpers.get_progran_onos_info()
 
@@ -48,6 +52,8 @@
         data = self.get_progran_profile_field(o)
 
         r = requests.post(profile_url, data=json.dumps(data), auth=HTTPBasicAuth(onos['username'], onos['password']))
+
+        ProgranHelpers.get_progran_rest_errors(r)
         log.info("Profile synchronized", response=r.json())
 
         log.info("sync'ing enodeb", object=str(o), **o.tologdict())
@@ -60,6 +66,7 @@
                 ]
             }
             r = requests.post(enodeb_url, data=json.dumps(data), auth=HTTPBasicAuth(onos['username'], onos['password']))
+            ProgranHelpers.get_progran_rest_errors(r)
             o.active_enodeb_id = o.enodeb_id # storing the value to know when it will be deleted
             log.info("EnodeB synchronized", response=r.json())
         elif o.active_enodeb_id:
@@ -67,12 +74,12 @@
             log.info("removing profile %s from enodeb %s" % (o.name, o.active_enodeb_id), object=str(o), **o.tologdict())
             enodeb_url = "http://%s:%s/onos/progran/enodeb/%s/profile/%s" % (onos['url'], onos['port'], enb_id, o.name)
             r = requests.delete(enodeb_url, auth=HTTPBasicAuth(onos['username'], onos['password']))
+            ProgranHelpers.get_progran_rest_errors(r)
             o.active_enodeb_id = 0 # removing the value because it has been deleted
             log.info("EnodeB synchronized", response=r.json())
 
         o.save()
 
-
     def get_handover_for_profile(self, o):
         return {
             "A3Hysteresis": o.handover.HysteresisA3,
@@ -114,4 +121,106 @@
         profile_url = "http://%s:%s/onos/progran/profile/%s" % (onos['url'], onos['port'], o.name)
         r = requests.delete(profile_url, auth=HTTPBasicAuth(onos['username'], onos['password']))
         o.active_enodeb_id = 0  # removing the value because it has been deleted
-        log.info("Profile synchronized", response=r.json())
\ No newline at end of file
+        log.info("Profile synchronized", response=r.json())
+
+    def fetch_pending(self, deleted):
+        # self.read_profiles_from_progran()
+        return super(SyncProgranServiceInstance, self).fetch_pending(deleted)
+
+    @staticmethod
+    def date_to_time(d):
+        if len(d) == 0:
+            return 0
+        return time.mktime(datetime.datetime.strptime(d, "%d.%m.%Y %H:%S").timetuple())
+
+    @staticmethod
+    def update_fields(model, dict, mapping={}, transformations={}):
+        dict = SyncProgranServiceInstance.convert_keys(dict, mapping, transformations)
+        for k, v in dict.iteritems():
+            if hasattr(model, k):
+                setattr(model, k, v)
+            else:
+                log.warn("%s does not have a '%s' property, not updating it" % (model.model_name, k))
+        return model
+
+    @staticmethod
+    def convert_keys(dict, mapping={}, transformations={}):
+        for k, v in dict.iteritems():
+            if k in mapping:
+                # apply custom transformations to the data
+                if k in transformations:
+                    dict[k] = transformations[k](v)
+
+                # NOTE we may have different names that the field in the dict
+                dict[mapping[k]] = dict[k]
+                del dict[k]
+        return dict
+
+
+    def my_call(self, failed=[], deletion=False):
+        """
+        Read profile from progran and save them in xos
+        """
+        if self.poll < 5:
+            self.poll = self.poll + 1
+        else:
+            self.poll = 0
+            onos = ProgranHelpers.get_progran_onos_info()
+            profile_url = "http://%s:%s/onos/progran/profile/" % (onos['url'], onos['port'])
+            r = requests.get(profile_url, auth=HTTPBasicAuth(onos['username'], onos['password']))
+            res = r.json()['ProfileArray']
+
+            # remove default profiles
+            res = [p for p in res if "Default" not in p['Name']]
+
+            field_mapping = {
+                'Name': 'name',
+                'Start': 'start',
+                'End': 'end'
+            }
+
+            field_transformations = {
+                'Start': SyncProgranServiceInstance.date_to_time,
+                'End': SyncProgranServiceInstance.date_to_time
+            }
+
+            handover_mapping = {
+                'A5Hysteresis': 'HysteresisA5',
+                'A3Hysteresis': 'HysteresisA3'
+            }
+
+            for p in res:
+
+                # checking for handovers
+                handover_dict = p['Handover']
+                handover_dict = SyncProgranServiceInstance.convert_keys(handover_dict, handover_mapping)
+                del p['Handover']
+
+                try:
+                    handover = Handover.objects.get(**handover_dict)
+                    log.info("handover already exists, updating it", handover=handover_dict)
+                except IndexError:
+                    handover = Handover()
+                    handover = SyncProgranServiceInstance.update_fields(handover, handover_dict)
+                    log.info("handover is new, creating it", handover=handover_dict)
+
+                handover.save()
+
+                # checking for profiles
+                try:
+                    si = ProgranServiceInstance.objects.get(name=p['Name'])
+                    log.info("Profile %s already exists, updating it" % p['Name'])
+                except IndexError:
+                    si = ProgranServiceInstance()
+                    si.name = p['Name']
+                    log.info("Profile %s is new, creating it" % p['Name'])
+
+                si = SyncProgranServiceInstance.update_fields(si, p, field_mapping, field_transformations)
+                si.handover = handover
+
+
+
+                # TODO keep track of the deleted profiles
+                # existing profiles - updated profiles = deleted profiles
+
+                si.save()
diff --git a/xos/synchronizer/steps/sync_progranserviceinstance_back.py b/xos/synchronizer/steps/sync_progranserviceinstance_back.py
new file mode 100644
index 0000000..ae97c95
--- /dev/null
+++ b/xos/synchronizer/steps/sync_progranserviceinstance_back.py
@@ -0,0 +1,126 @@
+
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+import os
+import sys
+
+import datetime
+import time
+
+from synchronizers.new_base.SyncInstanceUsingAnsible import SyncStep
+from synchronizers.new_base.modelaccessor import ProgranServiceInstance, ENodeB, Handover
+
+from xosconfig import Config
+from multistructlog import create_logger
+import json
+import requests
+from requests.auth import HTTPBasicAuth
+
+
+
+log = create_logger(Config().get('logging'))
+
+parentdir = os.path.join(os.path.dirname(__file__), "..")
+sys.path.insert(0, parentdir)
+sys.path.insert(0, os.path.dirname(__file__))
+from helpers import ProgranHelpers
+
+class SyncProgranServiceInstanceBack(SyncStep):
+    provides = [ProgranServiceInstance]
+
+    observes = ProgranServiceInstance
+
+
+    def call(self, failed=[], deletion=False):
+        """
+        Read profile from progran and save them in xos
+        """
+
+        if deletion == False:
+            # NOTE we won't it to run only after the delete has completed
+            return
+
+        log.info("Reading profiles from progran")
+        onos = ProgranHelpers.get_progran_onos_info()
+        profile_url = "http://%s:%s/onos/progran/profile/" % (onos['url'], onos['port'])
+        r = requests.get(profile_url, auth=HTTPBasicAuth(onos['username'], onos['password']))
+        res = r.json()['ProfileArray']
+
+        # remove default profiles
+        res = [p for p in res if "Default" not in p['Name']]
+
+        field_mapping = {
+            'Name': 'name',
+            'Start': 'start',
+            'End': 'end'
+        }
+
+        field_transformations = {
+            'Start': ProgranHelpers.date_to_time,
+            'End': ProgranHelpers.date_to_time
+        }
+
+        handover_mapping = {
+            'A5Hysteresis': 'HysteresisA5',
+            'A3Hysteresis': 'HysteresisA3'
+        }
+
+        updated_profiles = []
+
+        for p in res:
+
+            # checking for handovers
+            handover_dict = p['Handover']
+            handover_dict = ProgranHelpers.convert_keys(handover_dict, handover_mapping)
+            del p['Handover']
+
+            try:
+                handover = Handover.objects.get(**handover_dict)
+                log.info("handover already exists, updating it", handover=handover_dict)
+            except IndexError:
+                handover = Handover()
+                handover = ProgranHelpers.update_fields(handover, handover_dict)
+                log.info("handover is new, creating it", handover=handover_dict)
+
+            handover.save()
+
+            # checking for profiles
+            try:
+                si = ProgranServiceInstance.objects.get(name=p['Name'])
+                log.info("Profile %s already exists, updating it" % p['Name'])
+            except IndexError:
+                si = ProgranServiceInstance()
+                si.name = p['Name']
+
+                si.no_sync = True
+
+                log.info("Profile %s is new, creating it" % p['Name'])
+
+            si = ProgranHelpers.update_fields(si, p, field_mapping, field_transformations)
+            si.handover = handover
+
+            si.save()
+
+            updated_profiles.append(si.name)
+
+        existing_profiles = [p.name for p in ProgranServiceInstance.objects.all() if not p.is_new]
+        deleted_profiles = ProgranHelpers.list_diff(existing_profiles, updated_profiles)
+
+        if len(deleted_profiles) > 0:
+            log.info("Profiles %s have been removed in progran, removing them from XOS" % str(deleted_profiles))
+            for p in deleted_profiles:
+                si = ProgranServiceInstance.objects.get(name=p)
+                si.delete()
