 
 class PathNode: NSObject {
     var name : String!
-    private var children : [PathNode]!
+    var isDirectory : Bool = false
+    private var children : [PathNode]?
     var parent : PathNode?
     
-    override init() {
+    init(isDirectory: Bool, name: String) {
         super.init()
-        children = [PathNode]()
+        self.isDirectory = isDirectory
+        self.name = name
+        if isDirectory {
+            children = [PathNode]()
+        }
     }
     
     func addChild(child : PathNode) -> Bool {
-        children.append(child)
-        child.parent = self
-        return true
+        if self.isDirectory {
+            children!.append(child)
+            child.parent = self
+            return true
+        }
+        return false
     }
     
     func treepath() -> String! {

    func loadChildren() {
        let syspath = self.syspath()
        let fileManager = NSFileManager.defaultManager()
        let enumerator = fileManager.enumeratorAtPath(syspath)
        guard let _ = enumerator else {
            return
        }
        while let element = enumerator!.nextObject() as? String {
            let node = PathNode()
            node.name = element
            self.addChild(node)
            node.loadChildren()
        }

            i = i - 1
        }
        desc += " \(node.name)\n"
        
        guard node.isDirectory else {
            return desc
        }
        
        for child in node.children! {
            desc += traverseNode(level+1, node: child)
        }
        return desc
