           binding: tool.bindOptions
           index: tool.count
           pos: pos
-          z_index: parseInt(z_index)
+          z_index: z_index
+          settings_toggle: settings_toggle
         }
-
       tools.push obj
 
     state = {
-        'tools': tools
+        tools: tools
       }
 
     $.post 'http://localhost:3001/state', {state: JSON.stringify(state)}, (data) ->
-      console.log 'state saved', data
+      console.log 'id: ', data.id, 'state:', JSON.parse(data.state)
 
   load: (params) =>
     @trigger 'remove-all-tools'

      for new_tool in new_tools
        # Set settings
        toolWindow = new_tool.el.closest('.window-container')
        toolWindow.find(".data-sources [data-source=#{new_tool.bindOptions.type}]").click()
        toolWindow.find(".source-choices").val(new_tool.bindOptions.source)
        toolWindow.find(".data-points input[name=params]").val(new_tool.bindOptions.params)

  # Helpers
  getZIndex: (tool) ->
    z_index = if _.isNaN(parseInt(tool.el.css('z-index'))) then 0 else tool.el.css('z-index')
    

module.exports = State

    tools = []
    for tool in dashboard.tools
      pos = @getOffset tool
      z_index = @getZIndex tool
      settings_toggle = @getSettingsToggle tool
      obj = {
          name: tool.name
          className: tool.className
