     var isVisible: Bool = false {
         willSet {
             //keep track of prior subtree visibility
-            previousVisibleIndex = visibleTraversalIndex()
             if isVisible {
-                
+                previousVisibleIndex = visibleTraversalIndex()
                 previousVisibleChildren = visibleIndicesForTraversal()
             } else {
                 previousVisibleChildren = []

    
    public func encodeWithCoder(aCoder: NSCoder) {
        
    }
    
    //MARK: DebugPrintable

    
    public override init() {
        rootNode = IMGTreeNode()
    }
    
    init(rootNode: IMGTreeNode) {
        self.rootNode = rootNode
    }
    
    //MARK: tree construction class methods
