   getLayer: (nodeId)->
     @get('geoJSONLayer').getLayers().findBy('feature.properties.id', parseInt(nodeId, 10))
 
-  _openPopup: (nodeId)->
-    map = @get('map.layer')
-    marker = @getLayer(nodeId)
-
-    if marker?
-      marker.setZIndexOffset(marker.options.riseOffset)
-
+  getViewElement: ()->
+    unless @$nodeView?
       @$nodeView = $('.node-popup-view')
       @$nodeViewPrev = @$nodeView.prev()
 
-      map.openPopup @$nodeView[0], marker.getLatLng(),
-        className: 'node-popup'
-        offset: [0, -24]
-        closeOnClick: false
-        closeButton: false
-
-  _closePopup: (nodeId)->
-    map = @get('map.layer')
-    marker = @getLayer(nodeId)
-
-    if marker?
-      marker.setZIndexOffset(0)
-
+    @$nodeView[0]
+
+  resetViewElement: ()->
+    if @$nodeView? and @$nodeViewPrev?
       @$nodeViewPrev.after(@$nodeView)
+
       @$nodeView = null
       @$nodeViewPrev = null
 
-      map.closePopup()
+  _openPopup: (nodeId)->
+    marker = @getLayer(nodeId)
+
+    unless marker?
+      return
+
+    map = @get('map.layer')
+
+    marker.setZIndexOffset(marker.options.riseOffset)
+    viewElement = @getViewElement()
+
+    map.openPopup viewElement, marker.getLatLng(),
+      className: 'node-popup'
+      offset: [0, -24]
+      closeOnClick: false
+      closeButton: false
+
+  _closePopup: (nodeId)->
+    @getLayer(nodeId)?.setZIndexOffset(0)
+    @resetViewElement()
+    @get('map.layer').closePopup()
 
   _onClick: (event)->
     nodeId = null

        bbox: bounds.toBBoxString()

    request.then (data)->
      Ember.run.once(that, 'closePopup')
      Ember.run.once(that, 'replaceData', data)

      that.lastLoadedBounds = bounds.pad(Wheelmap.MarkerLayer.BOUNDS_CONTAINS_BUFFER)

  lastActiveCategories: null
  $nodeView: null
  $nodeViewPrev: null
  popupNodeId: null

  geoJSONLayer: (()->
    new L.GeoJSON null,
