         value = @ship?.primaryWeapon?.xp ? 0
         cells.push "#{value}"
         score = Math.round(value * 10)
-        cells.push "#{score}"
+        cells.push score
         @stats.bonus += score
       else
         cells.push ''

Crafty.c 'StageEnd',
  init: ->
    @requires '2D, DOM, Text, HUD, Delay'

  stageEnd: (level) ->
    @lineNr = 0
    this.attr w: 640, z: 1
      .css 'textAlign', 'center'
      .text "Stage #{level.data.stage} Cleared: #{level.data.title}"
      .positionHud(
        x: @x,
        y: 60,
        z: -1
      )
      .textColor('#FFFFFF')
      .textFont({
        size: '12px',
        weight: 'bold',
        family: 'Courier new'
      }).delay((i) ->
        switch @lineNr
          when 0
            @showPlayerHeaders()
            @showAccuracy level
          when 2 then @showShotsFired level
          when 3 then @showEnemiesKilled level
          when 4 then @showLives level
          when 5 then @showWeaponXP level
          when 6 then @showTotals level
          when 7 then level.data.stageFinished = yes
      , 1000, 6)

  showPlayerHeaders: ->
    cells = ['']

  addCelledLine: (cells) ->
    @lineNr += 1

    y = 150 + (@lineNr * 20)

    xOffset = 0
    cellWidth = 500.0 / (cells.length + .5)
    for cell, i in cells
      do (cell, i) =>
        cw = cellWidth
        cw += (cellWidth / 2.0) if i is 0
        if i is 0
          x = @x + xOffset
        else
          x = @x + xOffset + (cellWidth * (i + .5))

        c = Crafty.e('Text, DOM').attr(
          x: x
          y: y
          w: cw
          z: 3
        ).css 'textAlign', 'right'
          .text cell
          .textColor('#FFFFFF')
          .textFont({
            size: '12px',
            weight: 'normal',
            family: 'Courier new'
          })

        if i in [2, 4] and typeof cell is 'number'
          c.attr endScore: cell, v: 0
          c.text c.v
          c.bind 'EnterFrame', (fd) ->
            @v += (fd.dt * 3) + 3
            if @v > @endScore
              @v = @endScore
              @unbind 'EnterFrame'
            @text @v


        @attach c


