                         data.num_live_namespaces++
                     data.nshards += namespace_status.nshards
                     data.nreplicas += data.nshards + namespace_status.nreplicas
+                    # We should use _.uniq on the datacenters for all the tables, not on each table
                     data.ndatacenters += namespace_status.ndatacenters
 
+            # We update only if the data has changed
             if not _.isEqual @data, data
                 @data = data
                 @.$el.html @template data
 
             return @
 
+        # Unbind listeners
         destroy: =>
             namespaces.off 'all', @render
 


            return @

        close_alert: (event) ->
            event.preventDefault()
            $(event.currentTarget).parent().slideUp('fast', -> $(this).remove())

        rename_database: (event) =>
            event.preventDefault()
            rename_modal = new UIComponents.RenameItemModal @model.get('id'), 'database'
            rename_modal.render()

        delete_database: (event) ->
            event.preventDefault()
            remove_database_dialog = new DatabaseView.RemoveDatabaseModal
            remove_database_dialog.render @model

        destroy: =>
            @title.destroy()
            @profile.destroy()
            @performance_graph.destroy()

    class @Title extends Backbone.View
        className: 'database-info-view'
        template: Handlebars.compile $('#database_view_title-template').html()

        # Bind listeners
        initialize: =>
            @name = @model.get('name')
            @model.on 'change:name', @update

        # Update the title if the database has a new name
        update: =>
            if @name isnt @model.get('name')
                @name = @model.get('name')
                @render()

        # Render the view for the title
        render: =>
            @.$el.html @template
                name: @name
            return @

        # Unbind listeners
        destroy: =>
            @model.off 'change:name', @update

