 window.system_db = 'rethinkdb'
 
 $ ->
+    # Load the driver
     window.r = require('rethinkdb')
     window.driver = new Driver
 
     main_view = new MainView.MainContainer()
     $('body').html main_view.render().$el
 
+    # We need to start the router after the main view is bound to the DOM
     main_view.start_router()
 
     Backbone.sync = (method, model, success, error) ->

                            callback(err, result)


    run: (query, delay, callback) =>
        @index++
        @timers[@index] = {}
        ( (index) =>
            @connect (error, connection) =>
                if error?

            TermBase.run = ->
                throw new Error("You should remove .run() from your queries when using the Data Explorer.\nThe query will be built and sent by the Data Explorer itself.")

    # Open a connection to the server
    connect: (callback) ->
        r.connect @server, callback

    # Run a query once
    run_once: (query, callback) =>
        @connect (error, connection) =>
            if error?
