diff -urp old/workflow_ng/workflow_ng/workflow_ng.module new/workflow_ng/workflow_ng/workflow_ng.module
--- old/workflow_ng/workflow_ng/workflow_ng.module	2008-07-11 11:58:29.484375000 +0300
+++ new/workflow_ng/workflow_ng/workflow_ng.module	2008-07-11 11:59:26.375000000 +0300
@@ -1,12 +1,12 @@
 <?php
 // $Id: workflow_ng.module,v 1.1.2.15.2.7 2008/07/11 08:19:46 fago Exp $
 
-/*
- * Defines if an execution log should be displayed
+/**
+ * Defines if an execution log should be displayed.
  */
 define('WORKFLOW_NG_ENABLE_DEBUG', FALSE);
 
-// Also load available integration for all activated modules
+// Also load available integration for all activated modules.
 $path = drupal_get_path('module', 'workflow_ng') .'/modules';
 $files = drupal_system_listing('workflow_ng_.*\.inc$', $path, 'name', 0);
 
@@ -21,23 +21,30 @@ foreach($files as $file) {
 
 
 /*
- * Returns all defined events
- * @param $op Set it to 'labels' to get a list of event labels,
- *            otherwise you'll get the full definitions
- * @param $key If set, only return the value for this key. E.g. $op 'labels', with key 'example'
- *   will return the label of the event example
+ * Returns all defined events.
+ * 
+ * @param $op 
+ *  Set it to 'labels' to get a list of event labels,
+ *  otherwise you'll get the full definitions.
+ * @param $key 
+ *   If set, only return the value for this key. E.g. $op 'labels', 
+ *   with key 'example' will return the label of the event example.
  */
 function workflow_ng_get_events($op = 'all', $key = NULL) {
   return workflow_ng_gather_data('event_info', TRUE, $op, $key);
 }
 
-/*
- * Returns all defined actions
- * @param $op, $key: As for workflow_ng_get_events()
+/**
+ * Returns all defined actions.
+ * 
+ * @param $op
+ *   As per workflow_ng_get_events(). 
+ * @param $key
+ *   As per workflow_ng_get_events().
  */
 function workflow_ng_get_actions($op = 'all', $key = NULL) {
   $action_infos = workflow_ng_gather_data('action_info', FALSE, $op, $key);
-  //for now filter out the actions module actions
+  //for now filter out the actions module actions.
   return array_filter($action_infos, '_workflow_ng_element_has_label');
 }
 
@@ -45,17 +52,25 @@ function _workflow_ng_element_has_label(
   return isset($element['#label']);
 }
 
-/*
- * Returns all defined conditions
- * @param $op, $key: As for workflow_ng_get_events()
+/**
+ * Returns all defined conditions.
+ * 
+ * @param $op
+ *   As per workflow_ng_get_events(). 
+ * @param $key
+ *   As per workflow_ng_get_events().
  */
 function workflow_ng_get_conditions($op = 'all', $key = NULL) {
   return workflow_ng_gather_data('condition_info', FALSE, $op, $key);
 }
 
 /*
- * Returns all defined configurations
- * @param $op, $key: As for workflow_ng_get_events()
+ * Returns all defined configurations.
+ * 
+ * @param $op
+ *   As per workflow_ng_get_events(). 
+ * @param $key
+ *   As per workflow_ng_get_events().
  */
 function workflow_ng_get_configurations($op = 'all', $key = NULL) {
   static $included;
@@ -66,18 +81,26 @@ function workflow_ng_get_configurations(
   return workflow_ng_gather_data('configuration', TRUE, $op, $key);
 }
 
-/*
- * Gathers module definitions for the given name
- * Used for collecting events, configurations, actions and condtions from other modules
- *
- * @param $name The type of the data item to collect. This is also the name of the invoked hook.
- * @param $alter If workflow_ng_alter() should be used to let modules alter the data of other modules
- * @param $op Set it to 'labels' to get a list of data item labels,
- *            otherwise you'll get the full definitions
- * @param $key If set, only return the value for this key. E.g. $op 'labels', with key 'example'
- *             will return the label of the data item example
- * @param $reset If the static cache should be reseted. Note that if set to true, nothing will be
- *               returned.
+/**
+ * Gathers module definitions for the given name.
+ * Used for collecting events, configurations, actions and condtions 
+ * from other modules.
+ *
+ * @param $name 
+ *   The type of the data item to collect. This is also the name of the 
+ *   invoked hook.
+ * @param $alter 
+ *   If workflow_ng_alter() should be used to let modules alter the data 
+ *   of other modules.
+ * @param $op 
+ *   Set it to 'labels' to get a list of data item labels,
+ *   otherwise you'll get the full definitions.
+ * @param $key 
+ *   If set, only return the value for this key. E.g. $op 'labels', 
+ *   with key 'example' will return the label of the data item example.
+ * @param 
+ *   $reset If the static cache should be reseted. Note that if set to true, 
+ *   nothing will be returned.
  */
 function workflow_ng_gather_data($name, $alter = FALSE, $op = 'all', $key = NULL, $reset = FALSE) {
   static $data = array();
@@ -95,7 +118,8 @@ function workflow_ng_gather_data($name, 
     }
 
     foreach ($returned as $item_name => $info) {
-      $info['#type'] = $name;  //set the type to $name, so that element defaults can be applied later
+      // Set the type to $name, so that element defaults can be applied later.
+      $info['#type'] = $name;  
       $info['#name'] = $item_name;
       $data[$name]['labels'][$item_name] = $info['#label'];
       $data[$name]['all'][$item_name] = $info;
@@ -114,7 +138,7 @@ function workflow_ng_gather_data($name, 
   }
 }
 
-/*
+/**
  * Backport of drupal 6's drupal_alter to 5.x
  */
 function workflow_ng_alter($name, &$data) {
@@ -134,19 +158,23 @@ function workflow_ng_alter($name, &$data
   }
 }
 
-/*
- * Returns all active configurations for the event $event_name
+/**
+ * Returns all active configurations for the event $event_name.
  *
- * @param $event_name The event name, for which the configurations should be returned.
- * @param $reset May be set to true to clear the cache.
- * @return Returns the configured configurations for this event
+ * @param $event_name 
+ *   The event name, for which the configurations should be returned.
+ * @param $reset 
+ *   May be set to true to clear the cache.
+ * @return 
+ *   The configured configurations for this event.
  */
 function workflow_ng_event_get_configurations($event_name = NULL, $reset = FALSE) {
-  //We prevent a lot of queries by storing all event names with activated configurations with variable_set
+  // We prevent a lot of queries by storing all event names with activated 
+  // configurations with variable_set.
   static $configs;
 
   if (!isset($configs) || $reset) {
-    //initialize
+    // Initialize.
     $configs = variable_get('workflow_ng_configurations', array());
   }
 
@@ -155,19 +183,20 @@ function workflow_ng_event_get_configura
       $configs[$event_name] = unserialize($cache->data);
     }
     else {
-      //cache miss, so refresh the cache for all events
+      // Cache miss, so refresh the cache for all events.
       $configs = workflow_ng_get_configurations_by_event();
       $variable_cache = array();
       foreach (workflow_ng_get_events('labels') as $name => $label) {
         $configs += array($name => array());
-        //remove deactivated configurations
+        // Remove deactivated configurations.
         $configs[$name] = array_filter($configs[$name], '_workflow_ng_configuration_is_active');
-        //and write the cache
+        // Write the cache.
         if (count($configs[$name])) {
           cache_set('cfg_'. $name, 'cache_workflow_ng', serialize($configs[$name]));
         }
         else {
-          //write in the variable cache, that there are no configs for this event
+          // Write in the variable cache, that there are no configs 
+          // for this event.
           $variable_cache[$name] = array();
         }
       }
@@ -177,21 +206,23 @@ function workflow_ng_event_get_configura
   return isset($event_name) ? $configs[$event_name] : NULL;
 }
 
-/*
- * Helper for array_filter()
+/**
+ * Helper function for array_filter().
  */
 function _workflow_ng_configuration_is_active($configuration) {
   _workflow_ng_element_defaults($configuration);
   return $configuration['#active'];
 }
 
-/*
- * Gathers the configurations and returns the configurations for the given event
+/**
+ * Gathers the configurations and returns the configurations for the given event.
  * This bypasses any database cache!
  *
- * @param $event_name The event name, for which the configurations should be returned.
- *        Leave it empty, to get all configurations sorted by event.
- * @param $reset May be set to true to clear the static cache.
+ * @param $event_name 
+ *   The event name, for which the configurations should be returned.
+ *   Leave it empty, to get all configurations sorted by event.
+ * @param $reset 
+ *   May be set to true to clear the static cache.
  */
 function workflow_ng_get_configurations_by_event($event_name = NULL, $reset = FALSE) {
   static $configurations;
@@ -211,10 +242,12 @@ function workflow_ng_get_configurations_
   return isset($event_name) && isset($configurations[$event_name]) ? $configurations[$event_name] : $configurations;
 }
 
-/*
- * Clears the workflow-ng cache
- * @param $immediate If FALSE, the static cache will be kept until the next page load.
- *    Might be dangerous, so only use if you know what you are doing.
+/**
+ * Clear the workflow-ng cache.
+ * 
+ * @param $immediate 
+ *   If FALSE, the static cache will be kept until the next page load.
+ *   Might be dangerous, so only use if you know what you are doing.
  */
 function workflow_ng_clear_cache($immediate = TRUE) {
   cache_clear_all('cfg_', 'cache_workflow_ng', TRUE);
@@ -226,27 +259,30 @@ function workflow_ng_clear_cache($immedi
   }
 }
 
-/*
- * Invokes configured actions/conditions for the given event
- * @param $event_name As first param pass the event name
- * @params $args Pass further arguments as defined in hook_event_info() for this event.
+/**
+ * Invokes configured actions/conditions for the given event.
+ * 
+ * @param $event_name 
+ *   As first param pass the event name.
+ * @params $args 
+ *   Pass further arguments as defined in hook_event_info() for this event.
  */
 function workflow_ng_invoke_event() {
   $args = func_get_args();
   $event_name = array_shift($args);
   if ($event = workflow_ng_get_events('all', $event_name)) {
-    //apply the event element defaults
+    // Apply the event element defaults.
     _workflow_ng_element_defaults($event);
 
-    //log, if debugging is activated
+    // Log, if debugging is activated.
     $log = WORKFLOW_NG_ENABLE_DEBUG ? array() : FALSE;
     workflow_ng_write_log($log, t('Event @label has been invoked.', array('@label' => $event['#label'])));
 
-    //get the active configurations
+    // Get the active configurations.
     if ($configurations = workflow_ng_event_get_configurations($event_name)) {
-      //get the processed arguments
+      // Get the processed arguments.
       $arguments = _workflow_ng_process_arguments($event, $args);
-      //evaluate the configurations
+      // Evaluate the configurations.
       workflow_ng_evaluate_configurations($configurations, $arguments, $log);
     }
 
@@ -254,33 +290,39 @@ function workflow_ng_invoke_event() {
   }
 }
 
-/*
- * Evaluates the configurations by using workflow_ng_evaluate_elements()
+/**
+ * Evaluates the configurations by using workflow_ng_evaluate_elements().
  * Afterwards it cares for saving the modified arguments.
  *
- * @param $configurations The configurations to process
- * @param $arguments An array of arguments in format as returned from _workflow_ng_process_arguments()
- * @param $log An array of log entries. Set it to FALSE to disable logging, otherwise initialize it with array()
+ * @param $configurations 
+ *   The configurations to process.
+ * @param $arguments 
+ *   An array of arguments in format as returned 
+ *   from _workflow_ng_process_arguments().
+ * @param $log 
+ *   An array of log entries. Set it to FALSE to disable logging, 
+ *   otherwise initialize it with array().
  */
 function workflow_ng_evaluate_configurations($configurations, &$arguments, &$log) {
-  //First apply the configurations defaults
+  // First apply the configurations defaults.
   _workflow_ng_element_defaults($elements);
 
-  //then start processing
+  // Then start processing.
   workflow_ng_evaluate_elements($configurations, $arguments, $log);
 
-  //save all the changed arguments..
+  // Save all the changed arguments.
   foreach ($arguments['save'] as $argument_name) {
     workflow_ng_save_argument($arguments['info'][$argument_name], $argument_name, $arguments['data'][$argument_name], $log);
   }
-  //we have finished processing, so reset the recursion prevention log..
+  // We have finished processing, so reset the recursion prevention log.
   workflow_ng_evaluated_configurations(FALSE, TRUE);
 }
 
 
-/*
- * Evaluates the elements in a recursive way
- * The elements are a tree of configurations, conditions, actions and logical operations (AND, OR,..)
+/**
+ * Evaluates the elements in a recursive way.
+ * The elements are a tree of configurations, conditions, actions and logical 
+ * operations (AND, OR,..).
  *
  * Each element is executed by using workflow_ng_execute_element().
  *
@@ -288,21 +330,27 @@ function workflow_ng_evaluate_configurat
  * to customize the evaluation of the children. E.g. the element 'OR' does this and
  * evaluates to TRUE if at least one of its children evaluate to TRUE.
  *
- * @param $elements An array of elements to evaluate
- * @param $arguments An array of arguments in format as returned from _workflow_ng_process_arguments()
- * @param $log An array of log entries. Set it to FALSE to disable logging, otherwise initialize it with array()
+ * @param $elements 
+ *   An array of elements to evaluate.
+ * @param $arguments 
+ *   An array of arguments in format as returned from 
+ *   _workflow_ng_process_arguments().
+ * @param $log 
+ *   An array of log entries. Set it to FALSE to disable logging, 
+ *   otherwise initialize it with array().
  */
 function workflow_ng_evaluate_elements(&$elements, &$arguments, &$log) {
   $result = FALSE;
 
-  //Execute the current element if not yet executed
+  // Execute the current element if not yet executed.
   if (!isset($elements['#_executed'])) {
     $elements['#_executed'] = TRUE;
     $result = workflow_ng_execute_element($elements, $arguments, $log);
   }
 
-  // we default to evaluate like an AND, which means we stop as soon as one element evaluates to FALSE
-  // so if the element hasn't evaluated the children, start now
+  // We default to evaluate like an AND, which means we stop as soon as one 
+  // element evaluates to FALSE so if the element hasn't evaluated the children, 
+  // start now.
   if ((!isset($elements['#_evaluated']) || $elements['#_evaluated'] == FALSE)) {
     $elements['#_evaluated'] = TRUE;
     $result = workflow_ng_execute_and($elements, $arguments, $log);
@@ -310,8 +358,8 @@ function workflow_ng_evaluate_elements(&
   return $result;
 }
 
-/*
- * Sorts the children of the elements
+/**
+ * Helper function - sorts the children of the elements
  */
 function _workflow_ng_sort_children(&$element) {
   if (!isset($element['#_sorted'])) {
@@ -320,15 +368,17 @@ function _workflow_ng_sort_children(&$el
   }
 }
 
-/*
+/**
  * Callback function for uasort()
  */
 function _workflow_ng_element_sort($a, $b) {
   if (!is_array($a) || ($b['#type'] == 'action' && $a['#type'] != 'action')) {
-    return -1; //actions sink always down, element properties up
+
+    return -1; 
   }
   if (!is_array($b) || ($a['#type'] == 'action' && $b['#type'] != 'action')) {
-    return 1; //actions sink always down, element properties up
+    // Actions always sink down, element properties up.
+    return 1; 
   }
   $a += array('#weight' => 0, '#id' => 1000);
   $b += array('#weight' => 0, '#id' => 1000);
@@ -338,8 +388,8 @@ function _workflow_ng_element_sort($a, $
   return ($a['#weight'] < $b['#weight']) ? -1 : 1;
 }
 
-/*
- * Makes sure the element defaults are applied
+/**
+ * Makes sure the element defaults are applied.
  */
 function _workflow_ng_element_defaults(&$element) {
   if (!isset($element['#_defaults_applied'])) {
@@ -352,16 +402,21 @@ function _workflow_ng_element_defaults(&
 }
 
 /*
- * Executes the element by invoking the element type's execution handler
+ * Executes the element by invoking the element type's execution handler.
  *
- * @param $elements An array of elements to process
- * @param $arguments An array of arguments in format as returned from _workflow_ng_process_arguments()
- * @param $log An array of log entries. Set it to FALSE to disable logging
- * @return The execution result, or FALSE if there is no valid execution handler.
+ * @param $elements 
+ *   An array of elements to process.
+ * @param $arguments 
+ *   An array of arguments in format as returned from 
+ *   _workflow_ng_process_arguments().
+ * @param $log 
+ *   An array of log entries. Set it to FALSE to disable logging.
+ * @return 
+ *   The execution result, or FALSE if there is no valid execution handler.
  */
 function workflow_ng_execute_element(&$element, &$arguments, &$log) {
   if (isset($element['#type']) && isset($element['#execute']) && function_exists($element['#execute'])) {
-    //default to not process the children, if there is an execution handler
+    // Default to not process the children, if there is an execution handler.
     $element['#_evaluated'] = TRUE;
     $result = $element['#execute']($element, $arguments, $log);
     return isset($element['#negate']) && $element['#negate'] == TRUE ? !$result : $result;
@@ -369,28 +424,31 @@ function workflow_ng_execute_element(&$e
   return FALSE;
 }
 
-/*
- * Execution handler for configurations
- * We want each configuration to be evaluated, so let the following configurations
- * be processed by returning always TRUE.
+/**
+ * Execution handler for configurations.
+ * 
+ * We want each configuration to be evaluated, so let the following 
+ * configurations be processed by returning always TRUE.
  *
  */
 function workflow_ng_execute_configuration(&$element, &$arguments, &$log) {
   if ($element['#active'] && ($element['#recursion'] == TRUE || !in_array($element['#name'], workflow_ng_evaluated_configurations()))) {
 
     workflow_ng_write_log($log, t('Executing the configuration @name on event @event', array('@name' => $element['#label'], '@event' => workflow_ng_get_events('labels', $element['#event']))));
-    //remember that we are processing this configuration to prevent recursion
+    // Remember that we are processing this configuration to prevent recursion.
     workflow_ng_evaluated_configurations($element['#name']);
-    //let the the default evaluation (AND) apply to the configuration
+    // Let the the default evaluation (AND) apply to the configuration.
     workflow_ng_execute_and($element, $arguments, $log);
   }
-  //return true, so that the next configurations are evaluated too
+  // Return true, so that the next configurations are evaluated too.
   return TRUE;
 }
 
-/*
- * Execution handler for the OR element
- * Evaluates to TRUE if at least one children evaluate to TRUE..
+/**
+ * Execution handler for the OR element. 
+ * 
+ * @return 
+ *   Evaluates to TRUE if at least one children evaluate to TRUE.
  */
 function workflow_ng_execute_or(&$elements, &$arguments, &$log) {
   //first sort the children then process them
@@ -408,34 +466,42 @@ function workflow_ng_execute_or(&$elemen
   return FALSE;
 }
 
-/*
+/**
  * Execution handler for the AND element
- * Evaluates to TRUE if all children evaluate to TRUE..
+ * 
+ * @return 
+ *   Evaluates to TRUE if all children evaluate to TRUE.
  */
 function workflow_ng_execute_and(&$elements, &$arguments, &$log) {
-  //first sort the children then process them
+  // First sort the children then process them.
   _workflow_ng_sort_children($elements);
   //process them
   foreach (element_children($elements) as $key) {
     _workflow_ng_element_defaults($elements[$key]);
-     //propagate the event name down the tree, then recurse
+     // Propagate the event name down the tree, then recurse.
     $elements[$key] += array('#event' => $elements['#event']);
     $result = workflow_ng_evaluate_elements($elements[$key], $arguments, $log);
     if ($result === FALSE) {
-      //stop processing the children
+      // Stop processing the children.
       return FALSE;
     }
   }
   return TRUE;
 }
 
-/*
- * Execution handler for actions
+/**
+ * Execution handler for actions.
  *
- * @param $element The action's configuration element
- * @param $arguments An array of arguments in format as returned from _workflow_ng_process_arguments()
- * @param $log An array of log entries. Set it to FALSE to disable logging
- * @return TRUE to let workflow_ng proceed wit executing actions, only FALSE if $result['#halt'] is set.
+ * @param $element 
+ *   The action's configuration element.
+ * @param $arguments 
+ *   An array of arguments in format as returned from 
+ *   _workflow_ng_process_arguments().
+ * @param $log 
+ *   An array of log entries. Set it to FALSE to disable logging.
+ * @return 
+ *   TRUE to let workflow_ng proceed wit executing actions, 
+ *   only FALSE if $result['#halt'] is set.
  */
 function workflow_ng_execute_action($element, &$arguments, &$log) {
   if (isset($element['#name']) && function_exists($element['#name'])) {
@@ -444,11 +510,12 @@ function workflow_ng_execute_action($ele
     if ($exec_args !== FALSE) {
       $result = call_user_func_array($element['#name'], $exec_args);
 
-      //Add newly added arguments by the action
+      // Add newly added arguments by the action.
       if (isset($result['#new arguments']) && $result['#new arguments']) {
         workflow_ng_add_new_arguments($element, $result['#new arguments'], $arguments, $log);
       }
-      //An action may return altered arguments, which will be saved automatically
+      // An action may return altered arguments, which will be 
+      // saved automatically.
       if (isset($result) && is_array($result)) {
         $reverse_map = array_flip($element['#argument map']);
 
@@ -459,7 +526,7 @@ function workflow_ng_execute_action($ele
       }
       workflow_ng_write_log($log, t('Action execution: @name', array('@name' => workflow_ng_get_element_label($element))));
 
-      //this allows actions to act as conditions too
+      // This allows actions to act as conditions too.
       if (isset($result['#halt']) && $result['#halt']) {
         workflow_ng_write_log($log, t('Action @name evaluated to @bool.', array('@name' => workflow_ng_get_element_label($element), '@bool' => 'FALSE')));
         return FALSE;
@@ -470,14 +537,19 @@ function workflow_ng_execute_action($ele
   workflow_ng_missing_module($element);
 }
 
-/*
- * Execution handler for conditions
- * Note: An condition may not alter arguments
+/**
+ * Execution handler for conditions.
+ * Note: A condition may not alter arguments
  *
- * @param $element The condition's configuration element
- * @param $arguments An array of arguments in format as returned from _workflow_ng_process_arguments()
- * @param $log An array of log entries. Set it to FALSE to disable logging
- * @return The execution result of the condition, or if it is no valid condition FALSE.
+ * @param $element 
+ *   The condition's configuration element.
+ * @param $arguments 
+ *   An array of arguments in format as returned from 
+ *   _workflow_ng_process_arguments().
+ * @param $log 
+ *   An array of log entries. Set it to FALSE to disable logging.
+ * @return 
+ *   The execution result of the condition, or if it is no valid condition FALSE.
  */
 function workflow_ng_execute_condition($element, &$arguments, &$log) {
   if (isset($element['#name']) && function_exists($element['#name'])) {
@@ -496,8 +568,8 @@ function workflow_ng_execute_condition($
   return FALSE;
 }
 
-/*
- * Writes the message into the log
+/**
+ * Writes the message into the log.
  */
 function workflow_ng_write_log(&$log, $message) {
   if ($log !== FALSE && is_array($log)) {
@@ -506,33 +578,39 @@ function workflow_ng_write_log(&$log, $m
   }
 }
 
-/*
- * Returns the execution arguments needed by the given element
+/**
+ * Returns the execution arguments needed by the given element.
  * It applies the #argument map and gets all needed arguments.
  *
- * @param $element The configured element, which is to be executed
- * @param $arguments An array of arguments in format as returned from _workflow_ng_process_arguments()
- * @param $log An array of log entries. Set it to FALSE to disable logging
- * @return If not all execution arguments are available, it returns FALSE
+ * @param $element 
+ *   The configured element, which is to be executed.
+ * @param $arguments 
+ *   An array of arguments in format as returned from 
+ *   _workflow_ng_process_arguments().
+ * @param $log 
+ *   An array of log entries. Set it to FALSE to disable logging.
+ * @return 
+ *   If not all execution arguments are available, it returns FALSE.
  */
 function workflow_ng_get_execution_arguments(&$element, &$arguments, &$log) {
   $exec_args = array();
   $args_error = FALSE;
 
   $element_info = workflow_ng_get_element_info($element);
-  //initialize unset arguments in the argument map with pairs: name => name
-  //this allows ommitting such obvious mappings
+  // Initialize unset arguments in the argument map with pairs: name => name
+  // this allows ommitting such obvious mappings
   $reverse_map = array_flip($element['#argument map']) + drupal_map_assoc(array_keys($element_info['#arguments']));
   $element['#argument map'] = array_flip($reverse_map);
 
-  //get the right execution arguments by applying the argument map of this element
+  // Get the right execution arguments by applying the argument map of 
+  // this element.
   foreach ($element_info['#arguments'] as $argument_name => $info) {
     $event_arg_name = $reverse_map[$argument_name];
     $exec_args[$argument_name] = workflow_ng_element_get_argument($arguments, $event_arg_name, $log);
     $args_error = !isset($exec_args[$argument_name]) || $args_error;
   }
 
-  //we always append some other useful variables
+  // We always append some other useful variables.
   $settings = isset($element['#settings']) ? $element['#settings'] : array();
   $settings += array('#argument map' => $element['#argument map']);
   $exec_args[] = $settings;
@@ -543,11 +621,13 @@ function workflow_ng_get_execution_argum
 
 
 
-/*
- * Implementation of hook_elements()
- * Defines default values for all available properties of workflow_ng's element types
+/**
+ * Implementation of hook_elements().
+ * Defines default values for all available properties of workflow_ng's 
+ * element types.
  *
- * Note that the #process handlers are only used by the form API, but not by workflow-ng itself.
+ * Note that the #process handlers are only used by the form API, but not by 
+ * workflow-ng itself.
  */
 function workflow_ng_elements() {
   $types = array();
@@ -562,9 +642,9 @@ function workflow_ng_elements() {
   return $types;
 }
 
-/*
- * Processes the arguments of an event to an array in the style as it is required
- * for workflow_ng_evaluate_elements().
+/**
+ * Processes the arguments of an event to an array in the style as it is 
+ * required for workflow_ng_evaluate_elements().
  *
  * The returned array format is like:
  * array(
@@ -576,15 +656,17 @@ function workflow_ng_elements() {
  * Note that the order of the arguments will be kept, as it might be important for passing
  * the arguments to further argument loading handlers.
  *
- * @param $event The event info from the currently processed event
- * @param $args The argument data passed with the event invocation
+ * @param $event 
+ *   The event info from the currently processed event.
+ * @param $args 
+ *   The argument data passed with the event invocation.
  */
 function _workflow_ng_process_arguments($event, $args) {
   $argument_names = array_keys($event['#arguments']);
   $arguments = array('save' => array(), 'data' => array(), 'info' => $event['#arguments']);
 
   if (isset($args[0]) && count($args) == 1 && is_array($args[0]) && count($args[0]) > 0 && array_diff(array_keys($args[0]), $argument_names) === array()) {
-    //the caller passed an array of arguments, so let's use that
+    // The caller passed an array of arguments, so let's use that.
     $arguments['data'] = $args[0];
   }
   else {
@@ -597,19 +679,24 @@ function _workflow_ng_process_arguments(
   return $arguments;
 }
 
-/*
- * Returns the needed argument, which is given by the argument name. This function will take care of loading
- * further needed arguments, as necessary.
- *
- * @param $arguments The existing arguments in the format as returned from _workflow_ng_process_arguments()
- * @param $argument_name The arguments's machine readable name
- * @param $log An array of log entries. Set it to FALSE to disable logging
+/**
+ * Returns the needed argument, which is given by the argument name. 
+ * This function will take care of loading further needed arguments, 
+ * as necessary.
+ *
+ * @param $arguments 
+ *   The existing arguments in the format as returned from 
+ *   _workflow_ng_process_arguments().
+ * @param $argument_name 
+ *   The arguments's machine readable name.
+ * @param $log 
+ *   An array of log entries. Set it to FALSE to disable logging.
  */
 function workflow_ng_element_get_argument(&$arguments, $argument_name, &$log) {
 
   if (!isset($arguments['data'][$argument_name])) {
     if ($arguments['info'][$argument_name]['#handler'] && function_exists($arguments['info'][$argument_name]['#handler'])) {
-      //call the handler to get the runtime data
+      // Call the handler to get the runtime data.
       $arguments['data'][$argument_name] = call_user_func_array($arguments['info'][$argument_name]['#handler'], $arguments['data']);
       workflow_ng_write_log($log, t('Successfully loaded argument @arg', array('@arg' => $arguments['info'][$argument_name]['#label'])));
     }
@@ -617,8 +704,8 @@ function workflow_ng_element_get_argumen
   return $arguments['data'][$argument_name];
 }
 
-/*
- * Adds the new arguments to $arguments
+/**
+ * Adds the new arguments to $arguments.
  */
 function workflow_ng_add_new_arguments($element, $new_arguments, &$arguments, &$log) {
   foreach ($element['#new arguments'] as $event_name => $argument_info) {
@@ -632,8 +719,8 @@ function workflow_ng_add_new_arguments($
   }
 }
 
-/*
- * Gets the element info of an element (actions, conditions,..)
+/**
+ * Gets the element info of an element (actions, conditions,..).
  * Note that the element defaults will be applied before, if not yet done.
  */
 function workflow_ng_get_element_info(&$element) {
@@ -641,12 +728,13 @@ function workflow_ng_get_element_info(&$
   if ($element['#info'] && $element['#name']) {
     $info = workflow_ng_gather_data($element['#type'] .'_info', FALSE, 'all', $element['#name']);
     if (isset($info)) {
-      //apply the element info defaults
+      // Apply the element info defaults.
       $info['#type'] = $element['#type'] .'_info';
       _workflow_ng_element_defaults($info);
 
       if (array_key_exists('#description', $element) && isset($info['#description'])) {
-        unset($element['#description']); //Make sure the description is applied
+        // Make sure the description is applied.
+        unset($element['#description']); 
       }
       return $info;
     }
@@ -656,8 +744,8 @@ function workflow_ng_get_element_info(&$
   return array();
 }
 
-/*
- * Gets the element's label
+/**
+ * Gets the element's label.
  */
 function workflow_ng_get_element_label($element) {
   if (!isset($element['#label'])) {
@@ -667,20 +755,23 @@ function workflow_ng_get_element_label($
   return $element['#label'];
 }
 
-/*
- * A simple helping function, which eases the creation of configurations
- * Example use case:  $configuration['or'] = workflow_ng_configure('OR', $condition1, conditions2);
+/**
+ * A simple helping function, which eases the creation of configurations.
+ * Example use case: 
+ * $configuration['or'] = workflow_ng_configure('OR', $condition1, conditions2);
  *
- * @param $op One supported operation like 'AND', 'OR'. If ommitted the passed elements
+ * @param $op 
+ *   One supported operation like 'AND', 'OR'. If ommitted the passed elements
  *   will just be added to the first one.
- * @param $elements The elements to configure.
+ * @param $elements 
+ *   The elements to configure.
  */
 function workflow_ng_configure() {
   $args = func_get_args();
   $op = array_shift($args);
 
   if (!is_string($op) && is_array($op)) {
-    //just add the elements to the first element
+    // Just add the elements to the first element.
     return array_merge($op, $args);
   }
   $op = strtoupper($op);
@@ -690,30 +781,35 @@ function workflow_ng_configure() {
   return $element;
 }
 
-/*
- * Configures a condition for using in a configuration
+/**
+ * Configures a condition for using in a configuration.
  *
- * @param $name The name of condition to create, as specified at hook_condition_info()
- * @param $params An optional array of properties to add, e.g. #argument_map
+ * @param $name 
+ *   The name of condition to create, as specified at hook_condition_info().
+ * @param $params 
+ *   An optional array of properties to add, e.g. #argument_map.
  */
 function workflow_ng_use_condition($name, $params = array()) {
   $params += array('#name' => $name);
   return workflow_ng_use_element('condition', $params);
 }
 
-/*
- * Configures an action for using in a configuration
+/**
+ * Configures an action for using in a configuration.
  *
- * @param $name The name of action to create, as specified at hook_action_info()
- * @param $params An optional array of properties to add, e.g. #argument_map
+ * @param $name 
+ *   The name of action to create, as specified at hook_action_info().
+ * @param $params 
+ *   An optional array of properties to add, e.g. #argument_map.
  */
 function workflow_ng_use_action($name, $params = array()) {
   $params += array('#name' => $name);
   return workflow_ng_use_element('action', $params);
 }
 
-/*
- * Configures an element of type $type with the further properties $params for using in a configuration
+/**
+ * Configures an element of type $type with the further properties $params 
+ * for using in a configuration.
  */
 function workflow_ng_use_element($type, $params = array()) {
   $element = array('#type' => $type);
@@ -721,8 +817,8 @@ function workflow_ng_use_element($type, 
   return $element;
 }
 
-/*
- * Shows the log if it's active
+/**
+ * Shows the log if it's active.
  */
 function workflow_ng_show_log($log) {
   if (is_array($log) && count($log)) {
@@ -737,12 +833,16 @@ function workflow_ng_show_log($log) {
   }
 }
 
-/*
- * Remembers the currently evaluated configurations. With this information, recursion is prevented
+/**
+ * Remembers the currently evaluated configurations. With this information, 
+ * recursion is prevented.
  *
- * @param $add_name If set to FALSE, all already processed configurations will be returned
- *   Otherwise, the passed configuration name will be stored for further lookups.
- * @param $reset Clears the saved configurations if set.
+ * @param $add_name 
+ *   If set to FALSE, all already processed configurations will be returned
+ *   Otherwise, the passed configuration name will be stored 
+ *   for further lookups.
+ * @param $reset 
+ *   Clears the saved configurations if set.
  */
 function workflow_ng_evaluated_configurations($add_name = FALSE, $reset = FALSE) {
   static $memory = array();
@@ -756,12 +856,12 @@ function workflow_ng_evaluated_configura
   return $memory;
 }
 
-/*
+/**
  * Implementation of hook_configuration_alter()
  * Alters all per UI altered configurations.
  */
 function workflow_ng_configuration_alter(&$configurations) {
-  //Load all altered configurations and overwrite the default one
+  // Load all altered configurations and overwrite the default one.
   $result = db_query("SELECT * FROM {workflow_ng_cfgs} WHERE altered = 1");
 
   while ($row = db_fetch_object($result)) {
@@ -770,8 +870,8 @@ function workflow_ng_configuration_alter
   }
 }
 
-/*
- * Implementation of hook_configuration()
+/**
+ * Implementation of hook_configuration().
  * Adds all per UI created configurations.
  */
 function workflow_ng_configuration() {
@@ -787,17 +887,19 @@ function workflow_ng_configuration() {
   return $configurations;
 }
 
-/*
+/**
  * Shows an error message, that a module is missing.
  *
- * @param $element The element, for which the module is missing
- * @param $configuration_name The name of the configuration of the element
+ * @param $element 
+ *   The element, for which the module is missing.
+ * @param $configuration_name 
+ *   The name of the configuration of the element.
  */
 function workflow_ng_missing_module($element, $configuration_name = NULL) {
   static $history = array();
 
   if (isset($history[$element['#name']])) {
-    //error already generated
+    // Error already generated.
     return;
   }
   $history[$element['#name']] = TRUE;
@@ -811,7 +913,7 @@ function workflow_ng_missing_module($ele
   workflow_ng_handle_error_msg($msg, $configuration_name);
 }
 
-/*
+/**
  * Handles a error message. If the user has permission to administer workflow,
  * show him the error. Otherwise just log it.
  */
@@ -823,11 +925,13 @@ function workflow_ng_handle_error_msg($m
   watchdog('workflow-ng', $message, WATCHDOG_ERROR, $link);
 }
 
-/*
- * Determines if the given entity type is supported by the given info
+/**
+ * Determines if the given entity type is supported by the given info.
  *
- * @param $entity_type The entity type to check
- * @param $info The information data containing the #entity property
+ * @param $entity_type 
+ *   The entity type to check.
+ * @param $info 
+ *   The information data containing the #entity property.
  */
 function workflow_ng_is_valid_entity($entity_type, $info) {
   if (is_array($info['#entity'])) {
@@ -840,7 +944,7 @@ function workflow_ng_is_valid_entity($en
 }
 
 /**
- * Marks the given argument to be saved after configuration evaluation
+ * Marks the given argument to be saved after configuration evaluation.
  */
 function workflow_ng_set_argument_to_save($argument_name, $value, &$arguments) {
   //update the arguments for all following elements mark them for being saved later
@@ -850,15 +954,19 @@ function workflow_ng_set_argument_to_sav
   }
 }
 
-/*
- * Saves a modified argument
- * @param $info The argument info as specified through hook_event_info()
- * @param $argument_name The name of the argument to save
- * @param $value The new value of the argument
+/**
+ * Saves a modified argument.
+ * 
+ * @param $info 
+ *   The argument info as specified through hook_event_info().
+ * @param $argument_name 
+ *   The name of the argument to save.
+ * @param 
+ *   $value The new value of the argument.
  */
 function workflow_ng_save_argument($info, $argument_name, $value, &$log) {
   if (isset($info['#saved']) && $info['#saved']) {
-    //the argument is saved automatically, so we need to do nothing
+    // the argument is saved automatically, so we need to do nothing.
     return;
   }
   $entity_info = workflow_ng_gather_data('entity_info', FALSE);
@@ -871,8 +979,8 @@ function workflow_ng_save_argument($info
   }
 }
 
-/*
- * Implementation of hook_entity_info
+/**
+ * Implementation of hook_entity_info.
  */
 function workflow_ng_entity_info() {
   return array(
@@ -881,24 +989,24 @@ function workflow_ng_entity_info() {
   );
 }
 
-/*
- * Wrappers around drupal's saving functions
+/**
+ * Wrappers around drupal's saving functions.
  */
 function workflow_ng_node_save($node) {
-  //make sure to not create a new revision when workflow-ng saves a node
+  // Make sure to not create a new revision when workflow-ng saves a node.
   $node->revision = FALSE;
   node_save($node);
 }
 
-/*
- * Wrappers around drupal's saving functions
+/**
+ * Wrappers around drupal's saving functions.
  */
 function workflow_ng_comment_save($comment) {
   comment_save((array)$comment);
 }
 
-/*
- * Own version of array_intersect_key for php < 5.1
+/**
+ * Own version of array_intersect_key for php < 5.
  */
 if (!function_exists('array_intersect_key')) {
   function array_intersect_key() {
@@ -929,7 +1037,7 @@ if (!function_exists('array_combine')) {
 }
 
 /**
- * Implementation of hook_form_alter()
+ * Implementation of hook_form_alter().
  * Clear workflow-ng's cache when a module is deactivated
  */
 function workflow_ng_form_alter($form_id, $form) {
@@ -939,7 +1047,7 @@ function workflow_ng_form_alter($form_id
 }
 
 /**
- * Includes the given include file, if it exists
+ * Includes the given include file, if it exists.
  */
 function workflow_ng_include_file($filename) {
   $data = workflow_ng_gather_data('module_info', FALSE, 'all', $filename);
@@ -949,7 +1057,7 @@ function workflow_ng_include_file($filen
 }
 
 /**
- * Includes MODULENAME_filename for every module, if the file exists
+ * Includes MODULENAME_filename for every module, if the file exists.
  */
 function workflow_ng_module_include_all($filename) {
   $data = workflow_ng_gather_data('module_info', FALSE, 'all');
