   utils.set 'yourlsUrl',       $('#yourlsUrl').val().trim()
   utils.set 'yourlsUsername',  $('#yourlsUsername').val().trim()
 
-#### Validation functions
+# Update the specified `option` element that represents a feature with the
+# values taken from the available input fields.
+updateFeature = (opt) ->
+  if opt.length
+    opt.data 'content',  $('#feature_template').val()
+    opt.data 'enabled',  String $('#feature_enabled').is ':checked'
+    opt.data 'image',    $('#feature_image option:selected').val()
+    opt.data 'shortcut', $('#feature_shortcut').val().trim().toUpperCase()
+    opt.text $('#feature_title').val().trim()
+    opt.val  $('#feature_name').val().trim()
+    return opt
+
+# Update the existing feature with information extracted from the imported
+# feature provided.  
+# `feature` should not be altered in any way and the properties of `existing`
+# should only be changed if the replacement values are valid.  
+# Protected properties will only be updated if `existing` is not read-only and
+# the replacement value is valid.
+updateImportedFeature = (feature, existing) ->
+  # Ensure read-only features are protected.
+  unless existing.readOnly
+    existing.content = feature.content
+    # Only allow valid titles.
+    if feature.title.length > 0 and feature.title.length <= 32
+      existing.title = feature.title
+  existing.enabled = feature.enabled
+  # Only only existing images.
+  for image in ext.images when image.id is feature.image
+    existing.image = feature.image
+    break
+  # Only allow valid keyboard shortcuts.
+  existing.shortcut = feature.shortcut if isShortcutValid feature.shortcut
+  return existing
+
+# Update the selection of features in the toolbar behaviour section to reflect
+# those available in the features section.
+updateToolbarFeatures = ->
+  features                = []
+  toolbarFeatures         = $ '#toolbarFeatureName'
+  toolbarFeatureName      = utils.get 'toolbarFeatureName'
+  lastSelectedFeature     = toolbarFeatures.find 'option:selected'
+  lastSelectedFeatureName = ''
+  if lastSelectedFeature.length
+    lastSelectedFeatureName = lastSelectedFeature.val()
+  toolbarFeatures.find('option').remove()
+  $('#features option').each ->
+    $this = $ this
+    feature =
+      name:     $this.val()
+      selected: no
+      title:    $this.text()
+    if lastSelectedFeatureName
+      feature.selected = yes if feature.name is lastSelectedFeatureName
+    else if feature.name is toolbarFeatureName
+      feature.selected = yes
+    features.push feature
+  features.sort (a, b) ->
+    return a.title > b.title
+  for feature in features
+    option = $ '<option/>',
+      text:  "#{feature.title} (#{feature.name})"
+      value: feature.name
+    option.attr 'selected', 'selected' if feature.selected
+    toolbarFeatures.append option
+
+# Validation functions
+# --------------------
 
 # Indicate whether or not the specified `name` is available for use as a
 # feature.

  images       = $ '#feature_image'
  for image in ext.images
    $('<option/>',
      text:  image.name,
      value: image.id
    ).appendTo(images).data 'file', image.file
    if image.separate

  'string'  is typeof feature.shortcut and
  'string'  is typeof feature.title

# Miscellaneous functions
# -----------------------

# Create a feature from the information from the imported `feature` provided.  
# `feature` is not altered in any way and the new feature is only created if
