 
     name = name.toLowerCase()
 
-    if name of behaviours and not options?.replace
+    behaviourObject = definedBehaviours[name]
+
+    if behaviourObject and not options?.replace
       console.warn 'Behaviour already defined, use {replace: true} to override'
 
     else
-      behaviours[name] =
-        behaviour: behaviour
+      definedBehaviours[name] = behaviour: behaviour

behaviours = {}

share.attach = attach = (behaviour, args...) ->
  check behaviour, Match.OneOf Function, String

  if Match.test behaviour, String
    behaviour = behaviour.toLowerCase()
    options = behaviours[behaviour]?.options
    behaviour = behaviours[behaviour]?.behaviour

  if Match.test behaviour, Function
    context =
      collection: @
      options: options or {}

    behaviour.apply context, args

  else
    console.error "Attach failed, behaviour \"#{behaviour}\" not found"

  return

CollectionBehaviours =



    name = name.toLowerCase()

    behaviourObject = definedBehaviours[name]

    if behaviourObject
      behaviourObject.options = options

    else
      console.error "Configure failed, behaviour \"#{name}\" not found"
