     _bindEvents: ->
       addDelayedListener E("rle-encoded"), ["keypress", "blur", "change"], 200, => @fromRle()
 
-  fill_rules = (predefined_rules) ->
-    opts = E("select-rule").options
+  fill_rules = (select, predefined_rules) ->
+    opts = select.options
     for [name, rule], i in predefined_rules
       opts[i] = new Option(name, rule.stringify())
     opts[opts.length] = new Option("(User Defined)", "")

            dom.vars.subrule_delete?.addEventListener "click", (e) => @_removeSubRule i
            dom.vars.subrule_duplicate.addEventListener "click", (e) => @_duplicateSubRule i
            dom.vars.subrule_input.addEventListener "change", (e) => @setRuleFromControls()
          #store controls
          controls.push
            input: dom.vars.subrule_input
            delete_button: dom.vars.subrule_delete #can be undefined
        dom.end()
        container.innerHTML = ""

        golApp.ghost_click_detector.onTouch()
        handler e

    fill_rules E("select-rule"), predefinedRules

    
    fastButton "clear_field", -> golApp.do_clear()
