 		var spacing: CGFloat = 0
 		
 		if itemSpacing > 0.0 {
-			for index in 0..<slices.count {
-				let dataPoint = dataSource!.dataPointAtIndex(index)
-				
-				startPoint += dataPoint
-				
-				let endAngle: CGFloat = rangeMap(CGFloat(startPoint), min: 0.0, max: CGFloat(maxPoint), newMin: 0.0 + initialAngle, newMax: 2.0 * CGFloat(M_PI) + initialAngle)
-				
-				if startAngle > endAngle - itemSpacing {
-					spacing += itemSpacing
-				}
-				
-				if dataPoint == 0 {
-					spacing -= itemSpacing
-				}
-				
-				startAngle = endAngle
-			}
-			
-			startAngle = initialAngle
-			startPoint = 0
+			spacing = calculateSpacing(slices: slices)
 		}
 		
 		for index in 0..<slices.count {


import UIKit

public enum LineCapStyle {
	case straight
	case round
}


			}
		}
	}
	
	private func calculateSpacing(slices: [ASPCircleChartSliceLayer]) -> CGFloat {
		var startPoint: Double = 0
		
		var startAngle: CGFloat = initialAngle
		let maxPoint = dataSource!.dataPointsSum()
		var spacing: CGFloat = 0
		
		for index in 0..<slices.count {
			let dataPoint = dataSource!.dataPointAtIndex(index)
			
			startPoint += dataPoint
			
			let endAngle: CGFloat = rangeMap(CGFloat(startPoint), min: 0.0, max: CGFloat(maxPoint), newMin: 0.0 + initialAngle, newMax: 2.0 * CGFloat(M_PI) + initialAngle)
			
			if startAngle > endAngle - itemSpacing {
				spacing += itemSpacing
			}
			
			if dataPoint == 0 {
				spacing -= itemSpacing
			}
			
			startAngle = endAngle
		}
		
		return spacing
	}
}
