   deleteInstance:(anInstanceId)->
     @unregisterInstance anInstanceId
     # anInstance = null #FIXME: Redundant? See unregisterInstance
+
+  extend:(functions)->
+    for methodName, method of functions
+      @[methodName] = method
 
   registerSingleton:(singletonName,object,override = no)->
     if (existingSingleton = KD.singletons[singletonName])?

  getKDViewInstanceFromDomElement:(domElement)->
    @instances[$(domElement).data("data-id")]

  # Get next highest Z-index
  getNextHighestZIndex:(context)->
   uniqid = context.data 'data-id'
   if isNaN zIndexContexts[uniqid]
     zIndexContexts[uniqid] = 0
   else
     zIndexContexts[uniqid]++

  jsonhTest:->
    method    = 'fetchQuestionTeasers'
    testData  = {
      foo: 10
      bar: 11
    }

    start = Date.now()
    $.ajax "/#{method}.jsonh",
      data     : testData
      dataType : 'jsonp'
      success : (data)->
        inflated = JSONH.unpack data
        KD.log 'success', inflated
        KD.log Date.now()-start

  enableLogs:do->
    oldConsole = window.console
    window.console = {}


  create    : create
  new       : create

  debugStates     : {}
  instances       : {}
