diff --git a/multiscreen-compositor/qml/main.qml b/multiscreen-compositor/qml/main.qml
index 273409bbcce4ca82f7609eddbb2f1f0be9d32b13..f31c2dcd68b25423c8840ba847845843f7431250 100644
--- a/multiscreen-compositor/qml/main.qml
+++ b/multiscreen-compositor/qml/main.qml
@@ -164,36 +164,33 @@ WaylandCompositor {
 
             if (active_screen == i)
             {
-                var surfaceOnScreen = ({ 'surface': item, 'screen': active_screen });
-                activeSurfaces.push(surfaceOnScreen);
+                var activeSurface = ({ 'surface': item, 'screen': active_screen });
+                activeSurfaces.push(activeSurface);
             }
         }
         //! [createShellSurfaceItems]
         //createShellSurfaceItem(shellSurface, moveItem, screens.objectAt(active_screen));
     }
 
-    function getParentScreenId(iviId)
+    function getParentScreenId(pid)
     {
         for (var i=0; i < activeSurfaces.length; i++)
         {
-            var item = activeSurfaces[i].surface;
-            console.log("testing active surface", item.shellSurface.iviId, "for potential parenthood");
-            if ((item.shellSurface.iviId + 1) === iviId)
+            if (pid === activeSurfaces[i].pid)
             {
-                console.log("Found active parent surface", item.shellSurface.iviId, "on screen", activeSurfaces[i].screen);
+                console.log("Found active parent surface with pid", activeSurfaces[i].pid, "on screen", activeSurfaces[i].screen);
                 return activeSurfaces[i].screen;
             }
         }
         for (i=0; i < frozenSurfaceIds.length; i++)
         {
-            console.log("testing frozen surface id", frozenSurfaceIds[i].id, "for potential parenthood");
-            if ((frozenSurfaceIds[i].id + 1) === iviId)
+            if (pid === frozenSurfaceIds[i].pid)
             {
-                console.log("Found dead parent surface id", frozenSurfaceIds[i].id, "on screen", frozenSurfaceIds[i].screen);
+                console.log("Found frozen parent surface with pid", frozenSurfaceIds[i].pid, "on screen", frozenSurfaceIds[i].screen);
                 return frozenSurfaceIds[i].screen;
             }
         }
-        console.log("no parent found for iviId", iviId);
+        console.log("no parent found for pid", pid);
         return -1;
     }
 
@@ -214,11 +211,11 @@ WaylandCompositor {
         // if more than one screen is present.
         // If the unique ivi id is greater or equal 2000 we select screen 2
         console.log("handleIviSurfaceCreated: surface", iviSurface, "id", iviSurface.iviId);
-        cleanUpApplist();
+        //cleanUpApplist();
         var item;
         var screenId = 0;
         if (screens.count > 1) {
-            var parentScreenId = getParentScreenId(iviSurface.iviId);
+            var parentScreenId = getParentScreenId(iviSurface.surface.client.processId);
             if (parentScreenId >= 0)
             {
                 // associate new surface with parent ID's screen
@@ -226,25 +223,15 @@ WaylandCompositor {
             }
             else
             {
-                if (iviSurface.iviId > 1999)
-//                    item = createIviSurfaceItem(iviSurface, screens.objectAt(1));
-                    screenId = 1;
-                else
-//                    item = createIviSurfaceItem(iviSurface, screens.objectAt(0));
-                    screenId = 0;
+                screenId = (iviSurface.iviId >= 2000) ? 1 : 0;
             }
-        } else {
-//            item = createIviSurfaceItem(iviSurface, screens.objectAt(0));
-            screenId = 0;
         }
         item = createIviSurfaceItem(iviSurface, screens.objectAt(screenId));
 
+        var pid = item.shellSurface.surface.client.processId;
         console.log("Created IVI surface: ", item, "id", iviSurface.iviId, "screen", screenId);
-//        var surfaceOnScreen = ({ 'surface': item, 'screen': (iviSurface.iviId > 1999) ? 1 : 0 });
-        var surfaceOnScreen = ({ 'surface': item, 'screen': screenId });
-        activeSurfaces.push(surfaceOnScreen);
-        freezeIviId(iviSurface.iviId, screenId);
-        cleanUpFreezer();
+        var activeSurface = ({ 'surface': item, 'screen': screenId, 'iviId': iviSurface.iviId, 'pid': pid });
+        activeSurfaces.push(activeSurface);
     }
 
     function handleIviSurfaceRequested(surface, iviId, resource)
@@ -252,32 +239,6 @@ WaylandCompositor {
         console.log("IVI surface requested: surface", surface, "iviId", iviId, "resource", resource);
     }
 
-    function freezeIviId(iviId, screen)
-    {
-        var frozenSurface = ({ 'id': iviId, 'screen': screen });
-        frozenSurfaceIds.push(frozenSurface);
-    }
-
-    function cleanUpFreezer()
-    {
-        for (var i=0; i < frozenSurfaceIds.length; i++)
-        {
-            var iviId = frozenSurfaceIds[i].id;
-            var surfaceFound = false;
-            console.log("inspecting frozen iviId", iviId);
-            for (var j=0; j < activeSurfaces.length; j++)
-            {
-                if (iviId === activeSurfaces[j].surface.shellSurface.iviId)
-                    surfaceFound = true;
-            }
-
-            if (!surfaceFound)
-            {
-                console.log("no surface found for iviId", iviId);
-                frozenSurfaceIds = Array.from(frozenSurfaceIds).filter((e, idx) => e.id !== iviId)
-            }
-        }
-    }
 
     function cleanUpApplist()
     {
@@ -285,7 +246,9 @@ WaylandCompositor {
             var item = activeSurfaces[i];
             if ((!item.surface.shellSurface) && (!item.surface.surface))
             {
-                console.log("Removing lost surface from applist!")
+                console.log("Removing lost surface from applist and saving screen assignment! iviId:", item.iviId, "pid:", item.pid, "screen:", item.screen)
+                var frozenId = { 'iviId': item.iviId, 'pid': item.pid, 'screen': item.screen };
+                frozenSurfaceIds.push(frozenId);
                 activeSurfaces = Array.from(activeSurfaces).filter((e, idx) => idx !== i)
             }
         }
@@ -296,7 +259,6 @@ WaylandCompositor {
     // =============================================
     onSurfaceAboutToBeDestroyed: {
         cleanUpApplist();
-        //cleanUpFreezer();
     }
 
     // =============================================
@@ -320,18 +282,58 @@ WaylandCompositor {
         return;
     }
 
-    function updateScreenAssignment(surface, screen)
+    function getActiveSurfaces(pid)
     {
-        console.log("Updating screen for surface", surface);
+        var retArray = [];
+        console.log("getting all surfaces belonging to pid:", pid);
         for (var i=0; i < activeSurfaces.length; i++) {
             var item = activeSurfaces[i];
-            if (surface === item.surface) {
+            if ((item.surface.shellSurface) && ( pid === item.pid)) {
+                console.log("found IVI Shell Surface", i, pid, item.surface.shellSurface, item.surface.shellSurface.surface)
+                retArray.push(item.surface);
+            }
+        }
+        return retArray;
+    }
+
+    function getPidFromIviId(iviId)
+    {
+        var pid = -1;
+
+        for (var i=0; i < activeSurfaces.length; i++) {
+            if (activeSurfaces[i].iviId === iviId)
+            {
+                pid = activeSurfaces[i].pid;
+                console.log("found pid", pid, "for active iviId", iviId);
+            }
+        }
+        for (i=0; i < frozenSurfaceIds.length; i++) {
+            if (frozenSurfaceIds[i].iviId === iviId)
+            {
+                pid = frozenSurfaceIds[i].pid;
+                console.log("found pid", pid, "for frozen iviId", iviId);
+            }
+        }
+
+        return pid;
+    }
+
+    function updateScreenAssignment(pid, screen)
+    {
+        console.log("Updating screen for pid", pid);
+        var i=0;
+        var item = {};
+
+        for (i=0; i < activeSurfaces.length; i++) {
+            item = activeSurfaces[i];
+            if (pid === item.pid) {
                 item.screen = screen;
             }
         }
         for (i=0; i < frozenSurfaceIds.length; i++) {
-            if (surface.shellSurface.iviId === frozenSurfaceIds[i].id) {
-                frozenSurfaceIds[i].screen = screen;
+            item = frozenSurfaceIds[i];
+            if (pid === item.pid) {
+                item.screen = screen;
             }
         }
     }
@@ -350,6 +352,19 @@ WaylandCompositor {
                 return
             }
 
+            var affectedSurfaces = getActiveSurfaces(getPidFromIviId(windowid));
+            if (affectedSurfaces.length === 0) return;
+            for (var i=0; i < affectedSurfaces.length; i++)
+            {
+                var surface = affectedSurfaces[i];
+                if( !surface ) return;
+
+                console.log("Move", surface, "to screen", screenid)
+                surface.parent = screens.objectAt(screenid).surfaceArea;
+                updateScreenAssignment(getPidFromIviId(windowid), screenid);
+            }
+
+            /*
             var surface = findSurfaceById(windowid)
             if( !surface ) return;
 
@@ -362,9 +377,21 @@ WaylandCompositor {
             }
 
             updateScreenAssignment(surface, screenid);
+            */
         }
 
         function windowVisibility(windowid, show){
+            var affectedSurfaces = getActiveSurfaces(getPidFromIviId(windowid));
+            if (affectedSurfaces.length === 0) return;
+            for (var i=0; i < affectedSurfaces.length; i++)
+            {
+                var surface = affectedSurfaces[i];
+                if( !surface ) return;
+
+                console.log("Set visible to", show,"for", surface)
+                surface.visible = show
+            }
+            /*
             var surface = findSurfaceById(windowid)
             if( !surface ) return;
 
@@ -380,6 +407,7 @@ WaylandCompositor {
                     surface.toplevel.sendFullscreen(surface.surface.size);
                     surface.toplevel.setMinimized();
             }
+          */
         }
 
         function onHideWindow(windowid){
@@ -392,7 +420,7 @@ WaylandCompositor {
             windowVisibility(windowid, true)
         }
         function onLogWindows(){
-            cleanUpApplist();
+            //cleanUpApplist();
             console.log("Active surfaces:")
             for (var i=0; i < activeSurfaces.length; i++) {
                 var item = activeSurfaces[i];
@@ -405,9 +433,31 @@ WaylandCompositor {
             }
         }
         function onGetScreen(windowid){
-            cleanUpApplist();
+            //cleanUpApplist();
             console.log("Received a getScreen Signal for window ID: ", windowid)
+            var item = {};
+            var i = 0;
             var screenId = -1;
+
+            var pid = getPidFromIviId(windowid);
+
+            for (i=0; i < activeSurfaces.length; i++) {
+                item = activeSurfaces[i];
+                if (item.pid === pid)
+                {
+                    screenId = item.screen;
+                    console.log("found active surface with iviId", windowid, "pid", pid, "on screen", screenId);
+                }
+            }
+            for (i=0; i < frozenSurfaceIds.length; i++) {
+                item = frozenSurfaceIds[i];
+                if (item.pid === pid)
+                {
+                    screenId = item.screen;
+                    console.log("found frozen surface with iviId", windowid, "pid", pid, "on screen", screenId);
+                }
+            }
+            /*
             for (var i=0; i < activeSurfaces.length; i++) {
                 var item = activeSurfaces[i];
                 if (item.surface) {
@@ -422,6 +472,7 @@ WaylandCompositor {
                 }
 
             }
+            */
             commands.screenInfoReceived(screenId)
         }