     shadowColor : "\"rgba(0, 0, 255, 0.3)\""
     mergeSegments : "true, false (default)"
     minSize : "Number"
+    maxRewardedEndSegments : "Number"
 
 
   constructor : () ->
 
 
-  execute : ({ input : { rgba, segments, relativeTime, dimensions, mission }, minSize, startShape, fillColor, strokeColor, hitMode, lineWidth, colorRandom, customTime, reverse, endPosition, size, shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor, mergeSegments}) ->
+  execute : ({ input : { rgba, segments, relativeTime, dimensions, mission }, maxRewardedEndSegments, minSize, startShape, fillColor, strokeColor, hitMode, lineWidth, colorRandom, customTime, reverse, endPosition, size, shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor, mergeSegments}) ->
 
     width = dimensions[0]
     height = dimensions[1]


    if customTime?
      relativeTime = customTime

    shadowOffsetX = 0 unless shadowOffsetX
    shadowOffsetY = 0 unless shadowOffsetY

    activeSegments = _.sortBy(activeSegments, (s) -> -s.size)
    threeEndValues = []
    sortedEnds = _.sortBy(mission.possibleEnds, (s) -> -s.probability)
    for f in [0...Math.min(maxRewardedEndSegments, sortedEnds.length)]
      threeEndValues.push sortedEnds[f].id 

    for segment in activeSegments
