 
   circularCheck = (treePos, dep) -> # makes sure no circular references exists for dep going up from current point in tree (tree starts at top)
     requiree = treePos.name
+    chain = [dep]
     loop
-      #console.log "circularCheck for", dep, treePos.name, !!treePos.parent #, dep, treePos.parent
       return if treePos.parent is undefined # got all the way to @basePoint without finding self => good
+      chain.push treePos.name
       treePos = treePos.parent # follow the chain up
-
-      if treePos.name is dep
-        uncircularize(tree) # so that node is able to console.log it (cant log a circular structure)
-        throw new Error("circular dependency detected : #{treePos.name} <- .. <- #{requiree} <- #{treePos.name}")
+      throw new Error("circular dependency detected: #{chain.join(' <- ')} <- #{dep}") if treePos.name is dep
     return
 
   ((treePos) =>

#coffee      = require 'coffee-script'
fs          = require 'fs'
path        = require 'path'
detective   = require 'detective'

      arguments.callee(dep)
    return
  )(@tree) # creates an object of arrays of form [level, domain], so key,val of obj => val = [level, domain]
  ([key,val] for key,val of obj).sort((a,b) -> b[1][1] - a[1][1]).map((e) -> [e[0], e[1][1]]) # returns array of pairs where pair = [name, domain]
Organizer::writeCodeTree = (target) ->


# requiring this gives a function which returns a closured object with access to only the public methods of a bound instance
# TODO: include some strings to ignore [e.g. stuff from internal that require will handle outside default behaviour]
module.exports = (basePoint, domains, useLocalTests=false) ->
  throw new Error("brownie organizer: basePoint required") if !basePoint
