         
         switch event.keyCode
           when 13 #Enter
-            ###TODO: Encapsulate this code so the click event calls it too
-            if entered_text != "" #TODO: && not @my_tags[tag_text]?
-              #TODO: add to @my_tags not @tags
-              @tags[entered_text] ?= { users: [], weight: 0}
-              @tags[entered_text].users.push(Session.get('user_id'))
-              Posts.update(@_id, {$set: {tags: @tags}})
-              #clear textbox and update suggestion filter
-              event.target.value = ''
-              Session.set("filter_text_#{ @_id }", '')
-              Session.get("context_#{@_id}").invalidate()
-            ###
-            #Does this work?  It encapsulates the code pretty well
-            #$("button[name='enter_tag']").click()
-            Template.tagbox.add_tag(@tags, entered_text, event, @_id)
+            Template.tagbox.add_tag(@_id, @tags, [], entered_text, event.target)
           when 37 #Left-arrow: ADD
             if suggested_tag?
               @tags[suggested_tag] ?= { users: [], weight: 0}

      if not event.isImmediatePropagationStopped()
        tag_box = event.target.parentNode.getElementsByTagName(
          "textarea")[0]
        tag_text = tag_box.value
        #TODO: Encapsulate this code
        if tag_text != "" #TODO: && not @my_tags[tag_text]?
          #TODO: add to @my_tags not @tags
          @tags[tag_text] ?= { users: [], weight: 0}
          @tags[tag_text].users.push(Session.get('user_id'))
          Posts.update(@_id, {$set: {tags: @tags}})
          #clear textbox and update suggestion filter
          tag_box.value = ''
          Session.set("filter_text_#{ @_id }", '')
          Session.get("context_#{@_id}").invalidate()
        event.stopImmediatePropagation()
        
    "click button[name='done_tagging']": (event) ->

# -'TODO's indicate case-specific changes
###
_.extend( Template.tagbox,
  visible_tags: ->
    visible = (tag for tag of @tags)  #graduated tags
    @my_tags ?= {}                    #TODO: REMOVE on schema change
