define(['./spy', './dashboard', './user', './channel'], function (Spy, Dashboard, User, Channel) {
    'use strict';

    function getElement(target) {
        if (target === undefined || target === null) {
            return;
        }

        if (target.nodeType !== undefined) {
            // it's already a node
            return target;
        }

        // otherwise, we assume it's a selector
        return window.document.querySelector(target);
    }

    /* Application class */
    function Application(conf) {
        var user,
            channelName,
            container,
            infoFrame,
            dashboard,
            spy,
            channel;

        conf = conf || {};
        user = conf.user || User();

        // create the (communication) channel
        channelName = conf.channel || 'default';
        channel = Channel(channelName);
        channel.connect();

        // create the dashboard
        container = getElement(conf.container || window.document.body);
        dashboard = Dashboard(container, channel);

        // create the spy
        infoFrame = getElement(conf.infoFrame);
        if (infoFrame) {
            spy = Spy(infoFrame);
        }

        function destroy() {
            if (spy) {
                spy.enabled = false;
            }

            if (dashboard) {
                dashboard.enabled = false;
            }
        }

        return Object.freeze({
            user: user,
            channel: channel,
            dashboard: dashboard,
            spy: spy,
            destroy: destroy
        });
    }

    return Application;
});

@@ -1001,16 +1001,45 @@
 .body);%0A
+        if (container) %7B%0A    
         
@@ -1080,16 +1080,26 @@
 hannel);
+%0A        %7D
 %0A%0A      
@@ -1425,16 +1425,51 @@
        %7D
+%0A%0A            channel.disconnect();
 %0A       

Kill the connection on application exit