 
 # Encapsulates the general logic
 module.exports = ({matchedItemsProp, searchBus, columnsProp, bodyHeightStream, rowHeightStream}) ->
-  buses = {
+  bus = {
     bodyHeight : new Bacon.Bus()
     keydown    : new Bacon.Bus()
     scrollTop  : new Bacon.Bus()

        items.length * rowHeight - scrollTop - bodyHeight
      , matchedItemsProp, rowHeightProp, scrollTopProp, bodyHeightProp
  }).map (data) ->
    scrollableContent(data, buses.scrollTop)

  resizeHandleProp = bodyHeightProp.map (bodyHeight) ->
    resizeHandle(bodyHeight, buses.bodyHeight)

  headerProp = columnsProp.map (columns) ->
    header(columns)

  vdomTreeProp = Bacon.combineWith (contentHeader, scrollableContent, resizeHandle) ->
    h 'div.atom-notational-panel', {
      onclick: -> buses.focus.push undefined
    }, [
      search(buses.search, buses.keydown)
      contentHeader
      scrollableContent
      resizeHandle

      # Scroll item into the view if outside the visible border and was triggered by selectItem change
      if selectedRow = el.querySelector('.is-selected')
        selectedRow.scrollIntoViewIfNeeded(false) # centerIfNeeded=false => croll minimal possible to avoid jumps
    [bus.focus, elementProp], (..., el) ->
      el.querySelector('.search').focus()
    [resetStream, elementProp], (..., el) ->
      el.querySelector('.search').value = ''
      bus.search.push('')
    [bus.search, elementProp], (..., el) ->
      el.querySelector('.tbody').scrollTop = 0 #return to top
  )

