 # })();
 
 ((module, $, window) ->
+    selfTimestamp = '' + +new Date
+
     observer = new window.MutationObserver (mutations) ->
         module.checkProfile()
         module.listSources()

        module.checkElement window.document

    $ ->
        module.extension.init() if module.extension.init?
        module.comm.setOnUpdate forceUpdate


        mutations.each (mutation) ->
            Array.prototype.each.call mutation.addedNodes, (node) ->
                module.checkElement node

    selfDestructObserver = new window.MutationObserver (mutations) ->
        mutations.each (mutation) ->
            return unless mutation.type is 'attributes' and mutation.attributeName is 'data-iidentity-timestamp'

            newTimestamp = $ mutation.target
                .attr 'data-iidentity-timestamp'

            return if newTimestamp is selfTimestamp

            module.log.info 'Self-destructing', selfTimestamp, 'due to loading of second extension instance', newTimestamp

            # stop this extension
            observer.disconnect()
            module.comm.setOnUpdate ->

            selfDestructObserver.disconnect()

            false

    forceUpdate = ->
        module.doOnce.update()
