     if options.onoffer?
         do createDataChannel
 
+    # Send ice candidate.
     onicecandidate          = (event) =>
         if !event or !event.candidate or !peerConnection
             return
         if options.getice
             options.getice peerConnection.tunnel, event
 
+    # Add a received stream into the peerconnection.
     onaddstream             = (event) =>
         if options.gotstream?
             options.gotstream event
 
+    # Remove a stream.
     onremovestream          = (event) =>
         if options.removestream?
             options.removestream event
             
+    # Set datachannel callbacks.
     ondatachannel           = (event) =>
         setDataChannel event.channel
 

    peerConnection.tunnel   = options.tunnel
    peerConnection.channel  = null

    setDataChannel          = (channel) =>
        channel.onopen      = () =>
            if options.onChannelOpen?

            if options.onChannelError?
                do options.onChannelError

    # Check if datachannels are available and create one.
    createDataChannel       = () =>
        try
            if peerConnection.createDataChannel?
