     ev = stateChange.event
     ev.isRemote = true
     remoteIdx = _.pick(stateChange.prevState.slide, ['h', 'v'])
-    localSlideIdx = _.pick(CURRENT_LOCAL_SLIDE_STATE.slide, ['h', 'v'])
+    localSlideIdx = _.pick(getCurrentState().slide, ['h', 'v'])
     if remoteIdx.toString() != localSlideIdx.toString()
       # out of sync with remote, msgs must have been dropped.
       # sync first before replaying event.

  window.mainSlideDeck = deck = revealjsDomToSlideDeck()
  initSlide = deck.get(Reveal.getIndices())
  initState = new core.PresentationState(deck, initSlide)
  CURRENT_LOCAL_SLIDE_STATE = initState
  initState

initEventstreamSubscriptions = ->

utils = require "./utils"

CURRENT_LOCAL_SLIDE_STATE = null
setSlideState = (state) ->
  CURRENT_LOCAL_SLIDE_STATE = state
exports.getCurrentState = () -> CURRENT_LOCAL_SLIDE_STATE

################################################################################

