     # warn "Instance being overwritten!!", anInstance if @instances[anInstance.id]
     @instances[anInstance.id] = anInstance
     @classes[anInstance.constructor.name] ?= anInstance.constructor
-  
+
   unregisterInstance: (anInstanceId)->
     # warn "Instance being unregistered doesn't exist in registry!!", anInstance unless @instances[anInstance.id]
     delete @instances[anInstanceId]
-  
+
   deleteInstance:(anInstanceId)->
     @unregisterInstance anInstanceId
     # anInstance = null #FIXME: Redundant? See unregisterInstance
-  
+
   registerSingleton:(singletonName,object,override = no)->
     if (existingSingleton = KD.singletons[singletonName])?
       if override

    for subscription in @subscriptions
      if (!KDEventType? or !subscription.KDEventType? or !!KDEventType.match(subscription.KDEventType.capitalize()))
        subscription.callback.call subscription.subscribingInstance, publishingInstance, value, {subscription}
        
  # Get next highest Z-index
  getNextHighestZIndex:(context)->
   uniqid = context.data 'data-id'

    else
      # log "singleton registered! KD.singletons[\"#{singletonName}\"]"
      KD.singletons[singletonName] = object

  getSingleton:(singletonName)->
    if KD.singletons[singletonName]?
      KD.singletons[singletonName]
    else
      warn "\"#{singletonName}\" singleton doesn't exist!"
      null

  emptyDataCache:()->
    for own id,object of @getAllKDInstances
      if object instanceof KDData
        object.destroy()

  getAllKDInstances:()-> KD.instances

  getKDViewInstanceFromDomElement:(domElement)->
