               </g>}
         </svg>
 
-        {if @props.workflow.tasks[@props.annotation?.task]?.type is 'drawing'
-          selectedMark = @props.annotation.value[@props.annotation.value.length - 1]
-          tool = @props.workflow.tasks[@props.annotation.task].tools[selectedMark?.tool]
+        {if @props.workflow.tasks[@props.annotation?.task]?.type is 'drawing' and @state.selectedMark in @props.annotation.value
+          tool = @props.workflow.tasks[@props.annotation.task].tools[@state.selectedMark.tool]
           if tool?.details?
             <Tooltip at="middle right" from="middle left">
               {for detailTask, i in tool.details
                 detailTask._key ?= Math.random()
                 TaskComponent = tasks[detailTask.type]
-                <TaskComponent key={detailTask._key} task={detailTask} annotation={selectedMark.details[i]} onChange={updateAnnotations} />}
+                <TaskComponent key={detailTask._key} task={detailTask} annotation={@state.selectedMark.details[i]} onChange={updateAnnotations} />}
               <div className="actions">
-                <button type="button" className="standard-button">Close</button>
+                <button type="button" className="standard-button" onClick={@selectMark.bind this, null, null}>Close</button>
               </div>
             </Tooltip>}
       </SubjectViewer>

    x = (e.pageX - pageXOffset - rect.left) / scale.horizontal
    y = (e.pageY - pageYOffset - rect.top) / scale.vertical
    {x, y}

  render: ->
    scale = @getScale()


          {for annotation in @props.classification.annotations
            annotation._key ?= Math.random()
            isPriorAnnotation = annotation isnt @props.annotation
            taskDescription = @props.workflow.tasks[annotation.task]
            if taskDescription.type is 'drawing'
              <g key={annotation._key} className="marks-for-annotation" data-disabled={isPriorAnnotation or null}>
                {for mark, m in annotation.value
                  mark._key ?= Math.random()
                  toolDescription = taskDescription.tools[mark.tool]

                  toolEnv =
                    scale: scale
                    disabled: isPriorAnnotation
                    selected: mark is @state.selectedMark
                    getEventOffset: @getEventOffset

                  toolProps =
