diff --git a/workbench_moderation_notes.info b/workbench_moderation_notes.info
index 6249bf5..fcdf905 100644
--- a/workbench_moderation_notes.info
+++ b/workbench_moderation_notes.info
@@ -1,4 +1,10 @@
 name = Workbench Moderation Notes
 description = Adds a note field to workbench moderation.
 package = Workbench
-core = 7.x
\ No newline at end of file
+core = 7.x
+; Information added by drupal.org packaging script on 2013-10-26
+version = "7.x-1.x-dev"
+core = "7.x"
+project = "workbench_moderation_notes"
+datestamp = "1382797184"
+
diff --git a/workbench_moderation_notes.install b/workbench_moderation_notes.install
index bb2eb8c..4edc8f1 100644
--- a/workbench_moderation_notes.install
+++ b/workbench_moderation_notes.install
@@ -1,8 +1,8 @@
 <?php
 
- /**
-  * Implements hook_install().
-  */
+/**
+ * Implements hook_install().
+ */
 function workbench_moderation_notes_install() {
 	$field = array(
 		'type' => 'text',
@@ -15,8 +15,8 @@ function workbench_moderation_notes_install() {
 }
 
 /**
-* Implements hook_schema_alter()
-*/
+ * Implements hook_schema_alter()
+ */
 function workbench_moderation_notes_schema_alter(&$schema) {
   // Add field to existing schema.
   $schema['workbench_moderation_node_history']['fields']['note'] = array(
diff --git a/workbench_moderation_notes.module b/workbench_moderation_notes.module
index 93425d1..d97c278 100644
--- a/workbench_moderation_notes.module
+++ b/workbench_moderation_notes.module
@@ -1,37 +1,123 @@
 <?php
+/**
+ * @file
+ * Add transition notes to Workbench Moderation.
+ */
 
 /**
-* Implements hook_menu_alter()
-*/
+ * Implements hook_menu_alter().
+ */
 function workbench_moderation_notes_menu_alter(&$items) {
+  // Alter moderation history page.
   $items['node/%node/moderation']['page callback'] = 'workbench_moderation_notes_node_history_view';
   $items['node/%node/moderation']['file'] = 'workbench_moderation_notes.pages.inc';
   $items['node/%node/moderation']['file path'] = drupal_get_path('module', 'workbench_moderation_notes');
+  // Alter link to change a state directly to allow a note.
+  $items['node/%node/moderation/%/change-state/%']['page callback'] = 'workbench_moderation_notes_moderate_callback';
+}
+
+/**
+ * Show form for state change throught a direct link.
+ *
+ * @param object $node
+ *   The node being acted upon.
+ * @param string $state
+ *   The new moderation state requested.
+ */
+function workbench_moderation_notes_moderate_callback($node, $state) {
+  if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], "{$node->nid}:{$node->vid}:$state")) {
+    return MENU_ACCESS_DENIED;
+  }
+
+  return drupal_get_form('workbench_moderation_moderate_form', $node, $state);
+}
+
+/**
+ * Implements hook_module_implements_alter().
+ */
+function workbench_moderation_notes_module_implements_alter(&$implementations, $hook) {
+  // Do our hook_node_update last.
+  // We need this to make sure the transition log is already filled.
+  if ($hook == 'node_update' && isset($implementations['workbench_moderation_notes'])) {
+    $group = $implementations['workbench_moderation_notes'];
+    unset($implementations['workbench_moderation_notes']);
+    $implementations['workbench_moderation_notes'] = $group;
+  }
+}
+
+/**
+ * Implements hook_node_update().
+ *
+ * Copy revision log message to note field in transition log.
+ */
+function workbench_moderation_notes_node_update($node) {
+  // Apply moderation changes if this is a new revision or if the moderation
+  // state has changed.
+  if (!empty($node->revision) || $node->workbench_moderation_state_current != $node->workbench_moderation_state_new) {
+    // Alter last moderation message. We copy the revision log
+    // data to our note field if empty (this should always be the case).
+    _workbench_moderation_notes_update_note($node->nid, $node->vid, $node->workbench_moderation_state_new, $node->log);
+  }
 }
 
-function workbench_moderation_notes_form_workbench_moderation_moderate_form_alter(&$form) {
+/**
+ * Implements hook_form_alter().
+ */
+function workbench_moderation_notes_form_workbench_moderation_moderate_form_alter(&$form, $form_state) {
   if (isset($form['#access']) && $form['#access'] === FALSE) {
     return;
   }
+  // Add notes field.
   $form['note'] = array(
     '#type' => 'textarea',
     '#title' => t('Notes'),
     '#rows' => 2,
     '#weight' => -4,
-    );
+  );
+  // Check if a state was passed for the form.
+  if (isset($form_state['build_info']['args'][1])) {
+    $form['state']['#default_value'] = $form_state['build_info']['args'][1];
+  }
   unset($form['#theme']);
   unset($form['#attributes']['class']);
   $form['state']['#title'] = t('Select new status');
   $form['submit']['#value'] = t('Save');
   $form['#submit'][] = 'workbench_moderation_notes_form_workbench_moderation_moderate_form_alter_submit';
-  foreach($form['#submit'] as $k => $callback) {
+  foreach ($form['#submit'] as $k => $callback) {
     if ($callback == 'workbench_moderation_moderate_form_submit') {
       unset($form['#submit'][$k]);
     }
   }
 }
 
-/*
+/**
+ * Implements hook_form_alter().
+ */
+function workbench_moderation_notes_form_workbench_moderation_node_unpublish_form_alter(&$form) {
+  if (isset($form['#access']) && $form['#access'] === FALSE) {
+    return;
+  }
+  // Add message above notes field.
+  $form['message']['#weight'] = -5;
+  // Add notes field.
+  $form['note'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Notes'),
+    '#rows' => 2,
+    '#weight' => -4,
+  );
+  unset($form['#theme']);
+  unset($form['#attributes']['class']);
+  $form['state']['#title'] = t('Select new status');
+  $form['#submit'][] = 'workbench_moderation_notes_form_workbench_moderation_moderate_form_alter_submit';
+  foreach ($form['#submit'] as $k => $callback) {
+    if ($callback == 'workbench_moderation_moderate_form_submit') {
+      unset($form['#submit'][$k]);
+    }
+  }
+}
+
+/**
  * Submit callback to add the note to a workbench record.
  */
 function workbench_moderation_notes_form_workbench_moderation_moderate_form_alter_submit($form, $form_state) {
@@ -43,17 +129,8 @@ function workbench_moderation_notes_form_workbench_moderation_moderate_form_alte
   // used to publish the node, the draft tab will not be available after
   // publishing, and Drupal's will throw an access denied error before it is
   // able to redirect to the published revision.
-  
-  $query = db_select('workbench_moderation_node_history', 'w')
-                  ->condition('w.nid', $form_state['values']['node']->nid);
-  $query->addExpression('max(w.hid)', 'max_hid');
-  $latest_id = $query->execute()
-                  ->fetchField();
-  db_update('workbench_moderation_node_history')
-    ->condition('nid', $form_state['values']['node']->nid)
-    ->condition('hid', $latest_id)
-    ->fields(array('note' => $form_state['values']['note']))
-    ->execute();
+  _workbench_moderation_notes_update_note($form_state['values']['node']->nid, $form_state['values']['node']->vid, $form_state['values']['state'], $form_state['values']['note']);
+
   if (!empty($form['#destination'])) {
     if ($form_state['values']['state'] == workbench_moderation_state_published()) {
       if ($uri = entity_uri('node', $form['node']['#value'])) {
@@ -68,6 +145,25 @@ function workbench_moderation_notes_form_workbench_moderation_moderate_form_alte
 }
 
 /**
+ * Helper function to update the note based on the nid, vid and state.
+ */
+function _workbench_moderation_notes_update_note($nid, $vid, $state, $note) {
+  $query = db_select('workbench_moderation_node_history', 'w')
+    ->condition('w.nid', $nid)
+    ->condition('w.vid', $vid)
+    ->condition('w.state', $state)
+    ->isNull('w.note');
+  $query->addExpression('max(w.hid)', 'max_hid');
+  $latest_id = $query->execute()->fetchField();
+
+  db_update('workbench_moderation_node_history')
+    ->condition('nid', $nid)
+    ->condition('hid', $latest_id)
+    ->fields(array('note' => $note))
+    ->execute();
+}
+
+/**
  * Implements hook_views_api().
  */
 function workbench_moderation_notes_views_api() {
diff --git a/workbench_moderation_notes.pages.inc b/workbench_moderation_notes.pages.inc
index 4de08d4..af95fc5 100644
--- a/workbench_moderation_notes.pages.inc
+++ b/workbench_moderation_notes.pages.inc
@@ -1,12 +1,16 @@
 <?php
+/**
+ * @file
+ * Overwrite the moderation history page.
+ */
 
 /**
- * Page callback for workbench moderation view with notes
+ * Page callback for workbench moderation view with notes.
  */
 function workbench_moderation_notes_node_history_view($node) {
   global $user;
 
-  // Alert if there is no live node
+  // Alert if there is no live node.
   if (!isset($node->workbench_moderation['published'])) {
     drupal_set_message(t('Currently there is no published revision of this site.'), 'warning');
   }
@@ -106,9 +110,7 @@ function workbench_moderation_notes_node_history_view($node) {
     $items = array();
     foreach ($moderations as $moderation) {
       if ($moderation->from_state) {
-        $note = ($moderation->note)
-                  ?t('<br/><strong>Note:</strong><p>@note</p>', array('@note' => $moderation->note))
-                  : '';
+        $note = ($moderation->note) ? t('<br/><strong>Note:</strong><p>@note</p>', array('@note' => $moderation->note)) : '';
         $items[] = t('From @from_state --> @to_state on %date by !user !note',
           array(
             '@from_state' => workbench_moderation_state_label($moderation->from_state),
@@ -150,4 +152,4 @@ function workbench_moderation_notes_node_history_view($node) {
     '#header' => $header,
     '#rows' => $rows,
   );
-}
\ No newline at end of file
+}
diff --git a/workbench_moderation_notes.views.inc b/workbench_moderation_notes.views.inc
index d07d61a..58e1de3 100644
--- a/workbench_moderation_notes.views.inc
+++ b/workbench_moderation_notes.views.inc
@@ -1,8 +1,7 @@
 <?php
-
 /**
  * @file
- *  Content moderation views integration for Workbench Moderation Notes.
+ * Content moderation views integration for Workbench Moderation Notes.
  */
 
 /**
