 }
 
 
+
+/// Iterator that breaks down the byte stream
+/// into small chunks containing OSC packets
+struct ChunkIt : IteratorProtocol {
+    let bytes : ArraySlice<Byte>
+    var index : Int
+
+    init(_ bytes: ArraySlice<Byte>) { self.bytes = bytes; index = bytes.startIndex }
+
+    mutating func next() -> ArraySlice<Byte>? {
+        if index < bytes.endIndex, let len = Int(data: bytes[index..<(index+4)]) {
+            let d = bytes[(index+4)..<(index+4+len)]
+            index = index+4+len
+            return d
+        } else {
+            return nil
+        }
+    }
+}
+
+
+
 public struct OSCBundle : OSCConvertible {
     public let timetag : OSCTimeTag
 
-    /// TODO will be OSCConvertible once OSCMessage conforms to it
-    public let content : [OSCMessage]
+    /// Bundle elements 
+    public let content : [OSCConvertible]
 
     public var oscValue : [Byte] {
         var result = [Byte]()

        return result
    }

    public init(timetag: OSCTimeTag, content: [OSCMessage]) {
        self.timetag = timetag
        self.content = content
    }


        self.timetag = ts

        var msgs = [OSCConvertible]()

        // Read up the content
        // from offset
        var it = ChunkIt(bytes[(bytes.startIndex+16)..<bytes.endIndex] )
        while let chunk = it.next() {
            if let msg = OSCMessage(data: chunk ) {
                msgs.append(msg)
            } else if let bnd = OSCBundle(data: chunk) {
                msgs.append(bnd)
            }
        }


        self.content = msgs
    }
