   loadView:(mainView)->
     @joinChannel "@#{@username}"
     @joinChannel PUBLIC
-    #@joinChannel "#koding"
 
   joinChannel: (name) ->
-    return @channels[name] if @channels[name]
-
     view = @getOptions().view
     channelPaneInstance = view.addChannelTab name
+
+    if channel = @channels[name]      
+      return channel
 
     # When the tab is closed, remove the channel reference
     # and sign the user off from the channel

        @broadcastOwnMessage messageBody, PUBLIC, name

    # Delegates to the channel to handle received message
    @broadcaster.on channelName, (msg) =>
      @deliverMessageToChannel channel, msg

    @channels[name] = channel



  messageReceived: (message) ->
    @messages.push message
    unless @view.isActive()
      @unreadCount++ 
      @view.setUnreadCount @unreadCount
    @view.newMessage message

class ChatView extends KDView
