 extension XMLElement: CustomStringConvertible {
     /// The tag, attributes and content for a `XMLElement` instance (<elem id="foo">content</elem>)
     public var description: String {
-        var attributesString = allAttributes.map { $0.1.description }.joined(separator: " ")
-        if !attributesString.isEmpty {
-            attributesString = " " + attributesString
-        }
+        let attributesString = allAttributes.reduce("", { $0 + " " + $1.1.description })
 
         if !children.isEmpty {
             var xmlReturn = [String]()


    /// The inner text of the element, if it exists
    public var text: String {
        return children
            .map({ $0 as? TextElement })
            .flatMap({ $0 })
            .reduce("", { $0 + $1.text })
    }

    /// The inner text of the element and its children

    var index: Int

    var xmlChildren: [XMLElement] {
        return children.flatMap { $0 as? XMLElement }
    }

    /**
