diff --git a/storm.module b/storm.module
index eda480b..296be8d 100644
--- a/storm.module
+++ b/storm.module
@@ -1090,27 +1090,21 @@ function storm_icon_delete_node($node, $params=array()) {
 
 function storm_icon_add($path, $item, $params=array()) {
   global $user;
-  $type = $item->type;
-  $af = $type .'_access';
-  if (!$af('create', $item, $user)) return '';
+  if (!node_access('create', $item, $user)) return '';
   $attributes = array('class' => 'popups-form');
   return storm_icon_l('application_add', $path, t('Add'), '', $params, $attributes);
 }
 
 function storm_icon_edit($path, $item, $params=array()) {
   global $user;
-  $type = $item->type;
-  $af = $type .'_access';
-  if (!$af('update', $item, $user)) return '';
+  if (!node_access('update', $item, $user)) return '';
   $attributes = array('class' => 'popups-form');
   return storm_icon_l('application_edit', $path, t('Edit'), '', $params, $attributes);
 }
 
 function storm_icon_delete($path, $item, $params=array()) {
   global $user;
-  $type = $item->type;
-  $af = $type .'_access';
-  if (!$af('delete', $item, $user)) return '';
+  if (!node_access('delete', $item, $user)) return '';
   $attributes = array('class' => 'popups-form');
   return storm_icon_l('application_delete', $path, t('Delete'), '', $params, $attributes);
 }
diff --git a/storm_handler_field_operation.inc b/storm_handler_field_operation.inc
index 8cd1859..ded363d 100644
--- a/storm_handler_field_operation.inc
+++ b/storm_handler_field_operation.inc
@@ -34,12 +34,14 @@ class storm_handler_field_operation extends views_handler_field_node_link {
   }
 
   function render($values) {
+    global $user;
     // ensure user has access to edit this node.
     $node = new stdClass();
     $node->nid = $values->{$this->aliases['nid']};
     $node->uid = $values->{$this->aliases['uid']};
     $node->type = $values->{$this->aliases['type']};
     $node->format = $values->{$this->aliases['format']};
+    //TODO add stormorganization_nid and assigned_nid!
     $node->status = 1; // unpublished nodes ignore access control
     if ($this->options['display_icons']) {
       $value = "";
@@ -52,18 +54,14 @@ class storm_handler_field_operation extends views_handler_field_node_link {
       return $value;
     }
     else {
-      global $user;
-      $type = $node->type;
-      $af = $type .'_access';
-
       $value = "";
-      if ($af('update', $node, $user)) {
+      if (node_access('update', $node)) {
         $value .= l(t('edit'), "node/$node->nid/edit", array('query' => drupal_get_destination()));
       }
-      if (!empty($value)) {
-        $value .= '&nbsp;|&nbsp;';
-      }
-      if ($af('delete', $node, $user)) {
+      if (node_access('delete', $node)) {
+        if (!empty($value)) {
+          $value .= '&nbsp;|&nbsp;';
+        }
         $value .= l(t('delete'), "node/$node->nid/delete", array('query' => drupal_get_destination()));
       }
 
diff --git a/stormexpense/stormexpense.admin.inc b/stormexpense/stormexpense.admin.inc
index 840fd63..fd1bbaa 100644
--- a/stormexpense/stormexpense.admin.inc
+++ b/stormexpense/stormexpense.admin.inc
@@ -86,8 +86,10 @@ function stormexpense_list() {
     ),
   );
 
-  $s  = "SELECT n.*,  sex.* FROM {node} AS n INNER JOIN {stormexpense} AS sex ON n.vid=sex.vid
-  WHERE n.status=1 AND n.type='stormexpense' ";
+  $s  = "SELECT n.*,  sex.*, nre.format FROM {node} AS n
+    INNER JOIN {stormexpense} AS sex ON n.vid=sex.vid
+    INNER JOIN {node_revisions} AS nre ON n.vid = nre.vid
+    WHERE n.status=1 AND n.type='stormexpense' ";
 
   $s_totals = "SELECT SUM(amount) AS t_amount, SUM(tax1) AS t_tax1, SUM(tax2) AS t_tax2, SUM(total) AS t_total FROM
   {node} AS n INNER JOIN {stormexpense} AS sex ON n.vid=sex.vid WHERE n.status=1 AND n.type='stormexpense' ";
diff --git a/stormexpense/stormexpense.test b/stormexpense/stormexpense.test
index 9acda06..bb1d71e 100644
--- a/stormexpense/stormexpense.test
+++ b/stormexpense/stormexpense.test
@@ -14,7 +14,7 @@ class StormexpenseTestCase extends DrupalWebTestCase {
   }
 
   public function setUp() {
-    parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormticket', 'stormexpense');
+    parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormticket', 'stormexpense', 'stormperson');
   }
 
   public function testStormexpenseAccess() {
@@ -62,5 +62,130 @@ class StormexpenseTestCase extends DrupalWebTestCase {
     // Create a team
     $this->drupalGet('storm/expenses/report/std/en');
   }
+
+  public function testStormexpenseList() {
+    // Create and login user
+    $userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: access', 'Storm expense: add', 'Storm expense: view all', 'Storm expense: edit all', 'Storm expense: delete all', 'Storm person: add'));
+    $userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: access', 'Storm expense: add', 'Storm expense: view of user organization', 'Storm expense: edit of user organization', 'Storm expense: delete of user organization'));
+    $userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: access', 'Storm expense: add', 'Storm expense: view own', 'Storm expense: edit own', 'Storm expense: delete own'));
+    $userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: access', 'Storm expense: add', 'Storm expense: view all', 'Storm expense: edit own', 'Storm expense: delete own'));
+
+    $this->drupalLogin($userAll);
+
+    // Create organization
+    $org = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org, t('Save'));
+    $org = node_load(array('title' => $org['title']));
+
+    // Create organization
+    $org2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org2, t('Save'));
+    $org2 = node_load(array('title' => $org2['title']));
+
+    // Create stormperson with organization to userOrg
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userOrg->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+
+    // Create expenses
+    $exp1 = array(
+      'organization_nid' => $org->nid,
+      'title' => $this->randomName(32),
+    );
+    $this->drupalPost('node/add/stormexpense', $exp1, t('Save'));
+    $exp1 = node_load(array('title' => $exp1['title']));
+
+    $this->drupalLogin($userOwn);
+    $exp2 = array(
+      'title' => $this->randomName(32),
+      'organization_nid' => $org->nid,
+    );
+    $this->drupalPost('node/add/stormexpense', $exp2, t('Save'));
+    $exp2 = node_load(array('title' => $exp2['title']));
+
+    $this->drupalLogin($userViewAllEditOwn);
+    $exp3 = array(
+      'title' => $this->randomName(32),
+      'organization_nid' => $org2->nid,
+    );
+    $this->drupalPost('node/add/stormexpense', $exp3, t('Save'));
+    $exp3 = node_load(array('title' => $exp3['title']));
+
+    // Test for 'Storm expense: view all'
+    $this->drupalLogin($userAll);
+    $this->drupalGet('storm/expenses');
+
+    $this->assertLink($exp1->title, 0, 'The Expense appears on the list');
+    $this->assertRaw('node/'.$exp1->nid.'/edit', 'The Expense edit icon appears on the list');
+    $this->assertRaw('node/'.$exp1->nid.'/delete', 'The Expense edit icon appears on the list');
+
+    $this->assertLink($exp2->title, 0, 'The Expense appears on the list');
+    $this->assertRaw('node/'.$exp2->nid.'/edit', 'The Expense edit icon appears on the list');
+    $this->assertRaw('node/'.$exp2->nid.'/delete', 'The Expense edit icon appears on the list');
+
+    $this->assertLink($exp3->title, 0, 'The Expense appears on the list');
+    $this->assertRaw('node/'.$exp3->nid.'/edit', 'The Expense edit icon appears on the list');
+    $this->assertRaw('node/'.$exp3->nid.'/delete', 'The Expense edit icon appears on the list');
+
+    // Test for 'Storm expense: view of user organization'
+    $this->drupalLogin($userOrg);
+    $this->drupalGet('storm/expenses');
+
+    $this->assertLink($exp1->title, 0, 'The Expense appears on the list');
+    $this->assertRaw('node/'.$exp1->nid.'/edit', 'The Expense edit icon appears on the list');
+    $this->assertRaw('node/'.$exp1->nid.'/delete', 'The Expense edit icon appears on the list');
+
+    $this->assertLink($exp2->title, 0, 'The Expense appears on the list');
+    $this->assertRaw('node/'.$exp2->nid.'/edit', 'The Expense edit icon appears on the list');
+    $this->assertRaw('node/'.$exp2->nid.'/delete', 'The Expense edit icon appears on the list');
+
+    $this->assertNoLink($exp3->title, 'The Expense appears not on the list');
+    $this->assertNoRaw('node/'.$exp3->nid.'/edit', 'The Expense edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$exp3->nid.'/delete', 'The Expense edit icon does not appear on the list');
+
+    // Test for 'Storm expense: view own'
+    $this->drupalLogin($userOwn);
+    $this->drupalGet('storm/expenses');
+
+    $this->assertNoLink($exp1->title, 'The Expense appears not on the list');
+    $this->assertNoRaw('node/'.$exp1->nid.'/edit', 'The Expense edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$exp1->nid.'/delete', 'The Expense edit icon does not appear on the list');
+
+    $this->assertLink($exp2->title, 0, 'The Expense appears on the list');
+    $this->assertRaw('node/'.$exp2->nid.'/edit', 'The Expense edit icon appears on the list');
+    $this->assertRaw('node/'.$exp2->nid.'/delete', 'The Expense edit icon appears on the list');
+
+    $this->assertNoLink($exp3->title, 'The Expense appears not on the list');
+    $this->assertNoRaw('node/'.$exp3->nid.'/edit', 'The Expense edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$exp3->nid.'/delete', 'The Expense edit icon does not appear on the list');
+
+
+    // Test for 'Storm expense: view all', 'Storm expense: edit own'
+    $this->drupalLogin($userViewAllEditOwn);
+    $this->drupalGet('storm/expenses');
+
+    $this->assertLink($exp1->title, 0, 'The Expense appears on the list');
+    $this->assertNoRaw('node/'.$exp1->nid.'/edit', 'The Expense edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$exp1->nid.'/delete', 'The Expense edit icon does not appear on the list');
+
+    $this->assertLink($exp2->title, 0, 'The Expense appears on the list');
+    $this->assertNoRaw('node/'.$exp2->nid.'/edit', 'The Expense edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$exp2->nid.'/delete', 'The Expense edit icon does not appear on the list');
+
+    $this->assertLink($exp3->title, 0, 'The Expense appears on the list');
+    $this->assertRaw('node/'.$exp3->nid.'/edit', 'The Expense edit icon appears on the list');
+    $this->assertRaw('node/'.$exp3->nid.'/delete', 'The Expense edit icon appears on the list');
+
+  }
 }
 
diff --git a/stormexpense/stormexpense.theme.inc b/stormexpense/stormexpense.theme.inc
index bf4b8a6..e935840 100644
--- a/stormexpense/stormexpense.theme.inc
+++ b/stormexpense/stormexpense.theme.inc
@@ -7,14 +7,6 @@
 function theme_stormexpense_list($header, $expenses, $totals) {
   $rows = array();
   foreach ($expenses as $expense) {
-    $n = new stdClass();
-    $n->nid = $expense->nid;
-    $n->uid = $expense->uid;
-    $n->organization_nid = $expense->organization_nid;
-    $n->project_nid = $expense->project_nid;
-    $n->task_nid = $expense->task_nid;
-    $n->ticket_nid = $expense->ticket_nid;
-    $n->type = 'stormexpense';
     $rows[] = array(
       l($expense->organization_title, 'node/'. $expense->organization_nid),
       l($expense->project_title, 'node/'. $expense->project_nid),
@@ -22,7 +14,7 @@ function theme_stormexpense_list($header, $expenses, $totals) {
       format_date($expense->expensedate, 'custom', 'Y-m-d'),
       array('data' => sprintf('%.2f', $expense->total), 'align' => 'right'),
       array(
-        'data' => storm_icon_edit_node($n, $_GET) .'&nbsp;'. storm_icon_delete_node($n, $_GET),
+        'data' => storm_icon_edit_node($expense, $_GET) .'&nbsp;'. storm_icon_delete_node($expense, $_GET),
         'class' => 'storm_list_operations',
       ),
     );
diff --git a/storminvoice/storminvoice.admin.inc b/storminvoice/storminvoice.admin.inc
index 4209f8d..293a6ad 100644
--- a/storminvoice/storminvoice.admin.inc
+++ b/storminvoice/storminvoice.admin.inc
@@ -63,7 +63,10 @@ function storminvoice_list() {
     ),
   );
 
-  $s  = "SELECT n.title, sin.* FROM {node} AS n INNER JOIN {storminvoice} AS sin ON n.vid=sin.vid WHERE n.status=1 AND n.type='storminvoice' ";
+  $s  = "SELECT n.title, n.type, n.uid, sin.*, nre.format FROM {node} AS n
+    INNER JOIN {storminvoice} AS sin ON n.vid=sin.vid
+    INNER JOIN {node_revisions} AS nre ON n.vid = nre.vid
+    WHERE n.status=1 AND n.type='storminvoice' ";
 
   $s_totals_topay = "SELECT SUM(amount) amount, SUM(tax1) tax1, SUM(tax2) tax2, SUM(total) total FROM {storminvoice} sin
   INNER JOIN {node} n ON n.vid=sin.vid WHERE n.status=1 AND n.type='storminvoice' AND sin.paymentdate=0";
diff --git a/storminvoice/storminvoice.module b/storminvoice/storminvoice.module
index aaef07f..c6c888a 100644
--- a/storminvoice/storminvoice.module
+++ b/storminvoice/storminvoice.module
@@ -456,7 +456,7 @@ function storminvoice_form(&$node) {
 
   $count = (isset($node->items)) ? count($node->items) : 0;
   for ($k = $count; $k <= $count + 2; $k++) {
-    // $node->items[$k] = stdclass;
+    $node->items[$k] = new stdClass();
     $node->items[$k]->tax1app = variable_get('storm_tax1_app', 1);
     $node->items[$k]->tax1percent = variable_get('storm_tax1_percent', 20);
     $node->items[$k]->tax2app = variable_get('storm_tax2_app', 0);
@@ -719,6 +719,9 @@ function _storminvoice_beforesave(&$node) {
   $j = 0;
   $variable = 'items_'. $j . '_description';
   while (isset($node->$variable)) {
+    if (empty($node->items[$j])) {
+      $node->items[$j] = new stdClass();
+    }
     $node->items[$j]->description = $node->$variable;
     $variable = 'items_'. $j .'_amount';
     $node->items[$j]->amount = str_replace(',', '.', $node->$variable);
diff --git a/storminvoice/storminvoice.test b/storminvoice/storminvoice.test
index 9b13645..f0132e9 100644
--- a/storminvoice/storminvoice.test
+++ b/storminvoice/storminvoice.test
@@ -14,7 +14,7 @@ class StorminvoiceTestCase extends DrupalWebTestCase {
   }
 
   public function setUp() {
-    parent::setUp('storm', 'stormorganization', 'stormproject', 'storminvoice');
+    parent::setUp('storm', 'stormorganization', 'stormproject', 'storminvoice', 'stormperson');
   }
 
   public function testStorminvoiceAccess() {
@@ -55,6 +55,171 @@ class StorminvoiceTestCase extends DrupalWebTestCase {
     $this->drupalPost('node/add/stormorganization', $org, t('Save'));
     $this->drupalPost('node/add/storminvoice', $inv, t('Save'));
 
-    $this->assertText(t('Invoice @title has been created.', array('@title' => $inv['title'])));;
+    $this->assertText(t('Invoice @title has been created.', array('@title' => $inv['title'])));
+  }
+
+  public function testStorminvoiceList() {
+    // Create and login user
+    $userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: access', 'Storm invoice: add', 'Storm invoice: view all', 'Storm invoice: edit all', 'Storm invoice: delete all', 'Storm person: add'));
+    $userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: access', 'Storm invoice: add', 'Storm invoice: view of user organization', 'Storm invoice: edit of user organization', 'Storm invoice: delete of user organization'));
+    $userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: access', 'Storm invoice: add', 'Storm invoice: view own', 'Storm invoice: edit own', 'Storm invoice: delete own'));
+    $userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: access', 'Storm invoice: add', 'Storm invoice: view all', 'Storm invoice: edit own', 'Storm invoice: delete own'));
+
+    $this->drupalLogin($userAll);
+
+    // Create organization
+    $org = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org, t('Save'));
+    $org = node_load(array('title' => $org['title']));
+
+    // Create organization
+    $org2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org2, t('Save'));
+    $org2 = node_load(array('title' => $org2['title']));
+
+    // Create stormperson with organization to userOrg
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userOrg->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+
+    // Create invoices
+    $inv1 = array(
+      'title' => $this->randomName(32),
+      'organization_nid' => $org->nid,
+      'items_0_description' => $this->randomName(32),
+      'items_0_amount' => '100.0',
+      'items_0_tax1app' => '1',
+      'items_0_tax1percent' => '20',
+      'items_0_tax2app' => '2',
+      'items_0_tax2percent' => '10',
+    );
+    //tax1: 20; tax2: 12; total: 132
+    $this->drupalPost('node/add/storminvoice', $inv1, t('Save'));
+    $inv1 = node_load(array('title' => $inv1['title']));
+
+    $this->drupalLogin($userOwn);
+    $inv2 = array(
+      'title' => $this->randomName(32),
+      'organization_nid' => $org->nid,
+      'items_0_description' => $this->randomName(32),
+      'items_0_amount' => '200',
+      'items_0_tax1app' => '1',
+      'items_0_tax1percent' => '20',
+      'items_0_tax2app' => '0',
+      'items_0_tax2percent' => '10',
+    );
+    //tax1: 40; tax2: 0; total: 240
+    $this->drupalPost('node/add/storminvoice', $inv2, t('Save'));
+    $inv2 = node_load(array('title' => $inv2['title']));
+
+    $this->drupalLogin($userViewAllEditOwn);
+    $inv3 = array(
+      'title' => $this->randomName(32),
+      'organization_nid' => $org2->nid,
+      'items_0_description' => $this->randomName(32),
+      'items_0_amount' => '42,42',
+      'items_0_tax1app' => '0',
+      'items_0_tax1percent' => '5',
+      'items_0_tax2app' => '0',
+      'items_0_tax2percent' => '7.5',
+    );
+    //tax1: 0, tax2: 0; total: 42.42
+    $this->drupalPost('node/add/storminvoice', $inv3, t('Save'));
+    $inv3 = node_load(array('title' => $inv3['title']));
+
+    // Test for 'Storm invoice: view all'
+    $this->drupalLogin($userAll);
+    $this->drupalGet('storm/invoices');
+
+    $this->assertLink($inv1->title, 0, 'The Invoice appears on the list');
+    $this->assertRaw('node/'.$inv1->nid.'/edit', 'The Invoice edit icon appears on the list');
+    $this->assertRaw('node/'.$inv1->nid.'/delete', 'The Invoice edit icon appears on the list');
+
+    $this->assertLink($inv2->title, 0, 'The Invoice appears on the list');
+    $this->assertRaw('node/'.$inv2->nid.'/edit', 'The Invoice edit icon appears on the list');
+    $this->assertRaw('node/'.$inv2->nid.'/delete', 'The Invoice edit icon appears on the list');
+
+    $this->assertLink($inv3->title, 0, 'The Invoice appears on the list');
+    $this->assertRaw('node/'.$inv3->nid.'/edit', 'The Invoice edit icon appears on the list');
+    $this->assertRaw('node/'.$inv3->nid.'/delete', 'The Invoice edit icon appears on the list');
+
+    $this->assertRaw('342.42', 'Total amount is correct.');
+    $this->assertRaw('60.00', 'Total Tax1 is correct.');
+    $this->assertRaw('12.00', 'Total Tax2 is correct.');
+    $this->assertRaw('414.42', 'Total sum correct.');
+
+    // Test for 'Storm invoice: view of user organization'
+    $this->drupalLogin($userOrg);
+    $this->drupalGet('storm/invoices');
+
+    $this->assertLink($inv1->title, 0, 'The Invoice appears on the list');
+    $this->assertRaw('node/'.$inv1->nid.'/edit', 'The Invoice edit icon appears on the list');
+    $this->assertRaw('node/'.$inv1->nid.'/delete', 'The Invoice edit icon appears on the list');
+
+    $this->assertLink($inv2->title, 0, 'The Invoice appears on the list');
+    $this->assertRaw('node/'.$inv2->nid.'/edit', 'The Invoice edit icon appears on the list');
+    $this->assertRaw('node/'.$inv2->nid.'/delete', 'The Invoice edit icon appears on the list');
+
+    $this->assertNoLink($inv3->title, 'The Invoice appears not on the list');
+    $this->assertNoRaw('node/'.$inv3->nid.'/edit', 'The Invoice edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$inv3->nid.'/delete', 'The Invoice edit icon does not appear on the list');
+
+    $this->assertRaw('300.00', 'Total amount is correct.');
+    $this->assertRaw('60.00', 'Total Tax1 is correct.');
+    $this->assertRaw('12.00', 'Total Tax2 is correct.');
+    $this->assertRaw('372.00', 'Total sum correct.');
+
+    // Test for 'Storm invoice: view own'
+    $this->drupalLogin($userOwn);
+    $this->drupalGet('storm/invoices');
+
+    $this->assertNoLink($inv1->title, 'The Invoice appears not on the list');
+    $this->assertNoRaw('node/'.$inv1->nid.'/edit', 'The Invoice edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$inv1->nid.'/delete', 'The Invoice edit icon does not appear on the list');
+
+    $this->assertLink($inv2->title, 0, 'The Invoice appears on the list');
+    $this->assertRaw('node/'.$inv2->nid.'/edit', 'The Invoice edit icon appears on the list');
+    $this->assertRaw('node/'.$inv2->nid.'/delete', 'The Invoice edit icon appears on the list');
+
+    $this->assertNoLink($inv3->title, 'The Invoice appears not on the list');
+    $this->assertNoRaw('node/'.$inv3->nid.'/edit', 'The Invoice edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$inv3->nid.'/delete', 'The Invoice edit icon does not appear on the list');
+
+    $this->assertRaw('200.00', 'Total amount is correct.');
+    $this->assertRaw('40.00', 'Total Tax1 is correct.');
+    $this->assertRaw('0.00', 'Total Tax2 is correct.');
+    $this->assertRaw('240.00', 'Total sum correct.');
+
+    // Test for 'Storm invoice: view all', 'Storm invoice: edit own'
+    $this->drupalLogin($userViewAllEditOwn);
+    $this->drupalGet('storm/invoices');
+
+    $this->assertLink($inv1->title, 0, 'The Invoice appears on the list');
+    $this->assertNoRaw('node/'.$inv1->nid.'/edit', 'The Invoice edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$inv1->nid.'/delete', 'The Invoice edit icon does not appear on the list');
+
+    $this->assertLink($inv2->title, 0, 'The Invoice appears on the list');
+    $this->assertNoRaw('node/'.$inv2->nid.'/edit', 'The Invoice edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$inv2->nid.'/delete', 'The Invoice edit icon does not appear on the list');
+
+    $this->assertLink($inv3->title, 0, 'The Invoice appears on the list');
+    $this->assertRaw('node/'.$inv3->nid.'/edit', 'The Invoice edit icon appears on the list');
+    $this->assertRaw('node/'.$inv3->nid.'/delete', 'The Invoice edit icon appears on the list');
+
+    $this->assertRaw('342.42', 'Total amount is correct.');
+    $this->assertRaw('60.00', 'Total Tax1 is correct.');
+    $this->assertRaw('12.00', 'Total Tax2 is correct.');
+    $this->assertRaw('414.42', 'Total sum correct.');
+
   }
 }
diff --git a/storminvoice/storminvoice.theme.inc b/storminvoice/storminvoice.theme.inc
index 142c837..d330251 100644
--- a/storminvoice/storminvoice.theme.inc
+++ b/storminvoice/storminvoice.theme.inc
@@ -25,12 +25,6 @@
 function theme_storminvoice_list($header, $invoices, $itemsperpage, $totals_topay, $totals_paid, $totals) {
   $rows = array();
   foreach ($invoices as $invoice) {
-    $n = new stdClass();
-    $n->nid = $invoice->nid;
-    $n->uid = $invoice->uid;
-    $n->organization_nid = $invoice->organization_nid;
-    $n->project_nid = $invoice->project_nid;
-    $n->type = 'storminvoice';
 
     $invoice->status = 'open';
     if ($invoice->paymentdate) {
@@ -55,7 +49,7 @@ function theme_storminvoice_list($header, $invoices, $itemsperpage, $totals_topa
       format_date($invoice->requestdate, 'custom', 'Y-m-d'),
       array('data' => sprintf('%.2f', $invoice->total), 'align' => 'right'),
       array(
-        'data' => storm_icon_edit_node($n, $_GET) .'&nbsp;'. storm_icon_delete_node($n, $_GET),
+        'data' => storm_icon_edit_node($invoice, $_GET) .'&nbsp;'. storm_icon_delete_node($invoice, $_GET),
         'class' => 'storm_list_operations',
       ),
     );
diff --git a/stormnote/stormnote.admin.inc b/stormnote/stormnote.admin.inc
index e6dfd9d..1d2c70f 100644
--- a/stormnote/stormnote.admin.inc
+++ b/stormnote/stormnote.admin.inc
@@ -68,7 +68,10 @@ function stormnote_list() {
     ),
   );
 
-  $s  = "SELECT n.title, sno.* FROM {node} AS n INNER JOIN {stormnote} AS sno ON n.vid=sno.vid WHERE n.status=1 AND n.type='stormnote' ";
+  $s  = "SELECT n.title, n.type, n.uid, sno.*, nre.format FROM {node} AS n
+    INNER JOIN {stormnote} AS sno ON n.vid=sno.vid
+    INNER JOIN {node_revisions} AS nre ON n.vid = nre.vid
+    WHERE n.status=1 AND n.type='stormnote' ";
 
   $where = array();
   $args = array();
diff --git a/stormnote/stormnote.test b/stormnote/stormnote.test
index e650301..a514880 100644
--- a/stormnote/stormnote.test
+++ b/stormnote/stormnote.test
@@ -14,7 +14,7 @@ class StormnoteTestCase extends DrupalWebTestCase {
   }
 
   public function setUp() {
-    parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormnote');
+    parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormnote', 'stormperson');
   }
 
   public function testStormnoteAccess() {
@@ -61,4 +61,132 @@ class StormnoteTestCase extends DrupalWebTestCase {
 
     $this->assertText(t('Note @title has been created.', array('@title' => $note['title'])));;
   }
+
+  public function testStormnoteList() {
+    // Create and login user
+    $userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm note: access', 'Storm note: add', 'Storm note: view all', 'Storm note: edit all', 'Storm note: delete all', 'Storm person: add'));
+    $userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm note: access', 'Storm note: add', 'Storm note: view of user organization', 'Storm note: edit of user organization', 'Storm note: delete of user organization'));
+    $userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm note: access', 'Storm note: add', 'Storm note: view own', 'Storm note: edit own', 'Storm note: delete own'));
+    $userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm note: access', 'Storm note: add', 'Storm note: view all', 'Storm note: edit own', 'Storm note: delete own'));
+
+    $this->drupalLogin($userAll);
+
+    // Create organization
+    $org = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org, t('Save'));
+    $org = node_load(array('title' => $org['title']));
+
+    // Create organization
+    $org2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org2, t('Save'));
+    $org2 = node_load(array('title' => $org2['title']));
+
+    // Create stormperson with organization to userOrg
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userOrg->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+
+    // Create notes
+    $note1 = array(
+      'organization_nid' => $org->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormnote', $note1, t('Save'));
+    $note1 = node_load(array('title' => $note1['title']));
+
+    $this->drupalLogin($userOwn);
+    $note2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+    );
+    $this->drupalPost('node/add/stormnote', $note2, t('Save'));
+    $note2 = node_load(array('title' => $note2['title']));
+
+    $this->drupalLogin($userViewAllEditOwn);
+    $note3 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org2->nid,
+    );
+    $this->drupalPost('node/add/stormnote', $note3, t('Save'));
+    $note3 = node_load(array('title' => $note3['title']));
+
+    // Test for 'Storm note: view all'
+    $this->drupalLogin($userAll);
+    $this->drupalGet('storm/notes');
+
+    $this->assertLink($note1->title, 0, 'The Note appears on the list');
+    $this->assertRaw('node/'.$note1->nid.'/edit', 'The Note edit icon appears on the list');
+    $this->assertRaw('node/'.$note1->nid.'/delete', 'The Note delete icon appears on the list');
+
+    $this->assertLink($note2->title, 0, 'The Note appears on the list');
+    $this->assertRaw('node/'.$note2->nid.'/edit', 'The Note edit icon appears on the list');
+    $this->assertRaw('node/'.$note2->nid.'/delete', 'The Note delete icon appears on the list');
+
+    $this->assertLink($note3->title, 0, 'The Note appears on the list');
+    $this->assertRaw('node/'.$note3->nid.'/edit', 'The Note edit icon appears on the list');
+    $this->assertRaw('node/'.$note3->nid.'/delete', 'The Note delete icon appears on the list');
+
+    // Test for 'Storm note: view of user organization'
+    $this->drupalLogin($userOrg);
+    $this->drupalGet('storm/notes');
+
+    $this->assertLink($note1->title, 0, 'The Note appears on the list');
+    $this->assertRaw('node/'.$note1->nid.'/edit', 'The Note edit icon appears on the list');
+    $this->assertRaw('node/'.$note1->nid.'/delete', 'The Note delete icon appears on the list');
+
+    $this->assertLink($note2->title, 0, 'The Note appears on the list');
+    $this->assertRaw('node/'.$note2->nid.'/edit', 'The Note edit icon appears on the list');
+    $this->assertRaw('node/'.$note2->nid.'/delete', 'The Note delete icon appears on the list');
+
+    $this->assertNoLink($note3->title, 'The Note appears not on the list');
+    $this->assertNoRaw('node/'.$note3->nid.'/edit', 'The Note edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$note3->nid.'/delete', 'The Note delete icon appears not on the list');
+
+    // Test for 'Storm note: view own'
+    $this->drupalLogin($userOwn);
+    $this->drupalGet('storm/notes');
+
+    $this->assertNoLink($note1->title, 'The Note appears not on the list');
+    $this->assertNoRaw('node/'.$note1->nid.'/edit', 'The Note edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$note1->nid.'/delete', 'The Note delete icon appears not on the list');
+
+    $this->assertLink($note2->title, 0, 'The Note appears on the list');
+    $this->assertRaw('node/'.$note2->nid.'/edit', 'The Note edit icon appears on the list');
+    $this->assertRaw('node/'.$note2->nid.'/delete', 'The Note delete icon appears on the list');
+
+    $this->assertNoLink($note3->title, 'The Note appears not on the list');
+    $this->assertNoRaw('node/'.$note3->nid.'/edit', 'The Note edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$note3->nid.'/delete', 'The Note delete icon appears not on the list');
+
+
+    // Test for 'Storm note: view all', 'Storm note: edit own'
+    $this->drupalLogin($userViewAllEditOwn);
+    $this->drupalGet('storm/notes');
+
+    $this->assertLink($note1->title, 0, 'The Note appears on the list');
+    $this->assertNoRaw('node/'.$note1->nid.'/edit', 'The Note edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$note1->nid.'/delete', 'The Note edit icon does not appear on the list');
+
+    $this->assertLink($note2->title, 0, 'The Note appears on the list');
+    $this->assertNoRaw('node/'.$note2->nid.'/edit', 'The Note edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$note2->nid.'/delete', 'The Note delete icon appears not on the list');
+
+    $this->assertLink($note3->title, 0, 'The Note appears on the list');
+    $this->assertRaw('node/'.$note3->nid.'/edit', 'The Note edit icon appears on the list');
+    $this->assertRaw('node/'.$note3->nid.'/delete', 'The Note delete icon appears on the list');
+
+  }
 }
diff --git a/stormnote/stormnote.theme.inc b/stormnote/stormnote.theme.inc
index 16a7285..d8723d5 100644
--- a/stormnote/stormnote.theme.inc
+++ b/stormnote/stormnote.theme.inc
@@ -8,20 +8,13 @@ function theme_stormnote_list($header, $notes) {
   $rows = array();
 
   foreach ($notes as $note) {
-    $n = new stdClass();
-    $n->nid = $note->nid;
-    $n->uid = $note->uid;
-    $n->organization_nid = $note->organization_nid;
-    $n->project_nid = $note->project_nid;
-    $n->task_nid = $note->task_nid;
-    $n->type = 'stormnote';
     $rows[] = array(
       l($note->organization_title, 'node/'. $note->organization_nid),
       l($note->project_title, 'node/'. $note->project_nid),
       l($note->task_title, 'node/'. $note->task_nid),
       l($note->title, 'node/'. $note->nid),
       array(
-        'data' => storm_icon_edit_node($n, $_GET) .'&nbsp;'. storm_icon_delete_node($n, $_GET),
+        'data' => storm_icon_edit_node($note, $_GET) .'&nbsp;'. storm_icon_delete_node($note, $_GET),
         'class' => 'storm_list_operations',
       ),
     );
diff --git a/stormorganization/stormorganization.admin.inc b/stormorganization/stormorganization.admin.inc
index 8bbcd0e..b6a5d2c 100644
--- a/stormorganization/stormorganization.admin.inc
+++ b/stormorganization/stormorganization.admin.inc
@@ -35,7 +35,10 @@ function stormorganization_list() {
     ),
   );
 
-  $s = "SELECT n.*, sor.* FROM {node} AS n INNER JOIN {stormorganization} AS sor ON n.vid=sor.vid WHERE n.status=1 AND n.type='stormorganization'";
+  $s = "SELECT n.*, sor.*, nre.format FROM {node} AS n
+    INNER JOIN {stormorganization} AS sor ON n.vid=sor.vid
+    INNER JOIN {node_revisions} AS nre ON n.vid = nre.vid
+    WHERE n.status=1 AND n.type='stormorganization'";
 
   $where = array();
   $args = array();
diff --git a/stormorganization/stormorganization.test b/stormorganization/stormorganization.test
index de55ed4..dd36797 100644
--- a/stormorganization/stormorganization.test
+++ b/stormorganization/stormorganization.test
@@ -14,7 +14,7 @@ class StormorganizationTestCase extends DrupalWebTestCase {
   }
 
   public function setUp() {
-    parent::setUp('storm', 'stormorganization');
+    parent::setUp('storm', 'stormorganization', 'stormperson');
     $privileged_user = $this->drupalCreateUser(array('Storm organization: add'));
     $this->drupalLogin($privileged_user);
   }
@@ -43,4 +43,114 @@ class StormorganizationTestCase extends DrupalWebTestCase {
     $this->assertText(t('Organization @title has been created.', array('@title' => $edit['title'])));
   }
 
+  public function testStormorganizationList() {
+    // Create and login user
+    $userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: access', 'Storm organization: view all', 'Storm organization: edit all', 'Storm organization: delete all', 'Storm person: add'));
+    $userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: access', 'Storm organization: view belonged', 'Storm organization: edit belonged'));
+    $userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: access', 'Storm organization: view own', 'Storm organization: edit own', 'Storm organization: delete own'));
+    $userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: access', 'Storm organization: view all', 'Storm organization: edit own', 'Storm organization: delete own'));
+
+    $this->drupalLogin($userAll);
+
+    // Create organization
+    $organization1 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $organization1, t('Save'));
+    $organization1 = node_load(array('title' => $organization1['title']));
+
+    // Create stormperson with organization to userOrg
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $organization1->nid,
+      'user_name' => $userOrg->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+
+    // Create organization
+    $this->drupalLogin($userOwn);
+    $organization2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $organization2, t('Save'));
+    $organization2 = node_load(array('title' => $organization2['title']));
+
+    $this->drupalLogin($userViewAllEditOwn);
+    $organization3 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $organization3, t('Save'));
+    $organization3 = node_load(array('title' => $organization3['title']));
+
+    // Test for 'Storm organization: view all'
+    $this->drupalLogin($userAll);
+    $this->drupalGet('storm/organizations');
+
+    $this->assertLink($organization1->title, 0, 'The Organization appears on the list');
+    $this->assertRaw('node/'.$organization1->nid.'/edit', 'The Organization edit icon appears on the list');
+    $this->assertRaw('node/'.$organization1->nid.'/delete', 'The Organization edit icon appears on the list');
+
+    $this->assertLink($organization2->title, 0, 'The Organization appears on the list');
+    $this->assertRaw('node/'.$organization2->nid.'/edit', 'The Organization edit icon appears on the list');
+    $this->assertRaw('node/'.$organization2->nid.'/delete', 'The Organization edit icon appears on the list');
+
+    $this->assertLink($organization3->title, 0, 'The Organization appears on the list');
+    $this->assertRaw('node/'.$organization3->nid.'/edit', 'The Organization edit icon appears on the list');
+    $this->assertRaw('node/'.$organization3->nid.'/delete', 'The Organization edit icon appears on the list');
+
+    // Test for 'Storm organization: view belonged'
+    $this->drupalLogin($userOrg);
+    $this->drupalGet('storm/organizations');
+
+    $this->assertLink($organization1->title, 0, 'The Organization appears on the list');
+    $this->assertRaw('node/'.$organization1->nid.'/edit', 'The Organization edit icon appears on the list');
+    $this->assertNoRaw('node/'.$organization1->nid.'/delete', 'The Organization edit icon does not appear on the list');
+
+    $this->assertNoLink($organization2->title, 'The Organization appears on the list');
+    $this->assertNoRaw('node/'.$organization2->nid.'/edit', 'The Organization edit icon appears on the list');
+    $this->assertNoRaw('node/'.$organization2->nid.'/delete', 'The Organization edit icon does not appear on the list');
+
+    $this->assertNoLink($organization3->title, 'The Organization appears not on the list');
+    $this->assertNoRaw('node/'.$organization3->nid.'/edit', 'The Organization edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$organization3->nid.'/delete', 'The Organization edit icon does not appear on the list');
+
+    // Test for 'Storm organization: view own'
+    $this->drupalLogin($userOwn);
+    $this->drupalGet('storm/organizations');
+
+    $this->assertNoLink($organization1->title, 'The Organization appears not on the list');
+    $this->assertNoRaw('node/'.$organization1->nid.'/edit', 'The Organization edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$organization1->nid.'/delete', 'The Organization edit icon does not appear on the list');
+
+    $this->assertLink($organization2->title, 0, 'The Organization appears on the list');
+    $this->assertRaw('node/'.$organization2->nid.'/edit', 'The Organization edit icon appears on the list');
+    $this->assertRaw('node/'.$organization2->nid.'/delete', 'The Organization edit icon appears on the list');
+
+    $this->assertNoLink($organization3->title, 'The Organization appears not on the list');
+    $this->assertNoRaw('node/'.$organization3->nid.'/edit', 'The Organization edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$organization3->nid.'/delete', 'The Organization edit icon does not appear on the list');
+
+
+    // Test for 'Storm organization: view all', 'Storm organization: edit own'
+    $this->drupalLogin($userViewAllEditOwn);
+    $this->drupalGet('storm/organizations');
+
+    $this->assertLink($organization1->title, 0, 'The Organization appears on the list');
+    $this->assertNoRaw('node/'.$organization1->nid.'/edit', 'The Organization edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$organization1->nid.'/delete', 'The Organization edit icon does not appear on the list');
+
+    $this->assertLink($organization2->title, 0, 'The Organization appears on the list');
+    $this->assertNoRaw('node/'.$organization2->nid.'/edit', 'The Organization edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$organization2->nid.'/delete', 'The Organization edit icon does not appear on the list');
+
+    $this->assertLink($organization3->title, 0, 'The Organization appears on the list');
+    $this->assertRaw('node/'.$organization3->nid.'/edit', 'The Organization edit icon appears on the list');
+    $this->assertRaw('node/'.$organization3->nid.'/delete', 'The Organization edit icon appears on the list');
+
+  }
+
 }
diff --git a/stormorganization/stormorganization.theme.inc b/stormorganization/stormorganization.theme.inc
index 1dd3921..04633f0 100644
--- a/stormorganization/stormorganization.theme.inc
+++ b/stormorganization/stormorganization.theme.inc
@@ -10,16 +10,11 @@ function theme_stormorganization_list($header, $organizations) {
   $rows = array();
   $countries = storm_attributes_bydomain('Country');
   foreach ($organizations as $key => $organization) {
-    $n = new stdClass();
-    $n->nid = $organization->nid;
-    $n->uid = $organization->uid;
-    $n->type = 'stormorganization';
-
     $rows[] = array(
       l($organization->title, 'node/'. $organization->nid),
       check_plain($countries['values'][$organization->country]),
       array(
-        'data' => storm_icon_edit_node($n, $_GET) .'&nbsp;'. storm_icon_delete_node($n, $_GET),
+        'data' => storm_icon_edit_node($organization, $_GET) .'&nbsp;'. storm_icon_delete_node($organization, $_GET),
         'class' => 'storm_list_operations',
       ),
     );
diff --git a/stormperson/stormperson.admin.inc b/stormperson/stormperson.admin.inc
index a7822fa..9442096 100644
--- a/stormperson/stormperson.admin.inc
+++ b/stormperson/stormperson.admin.inc
@@ -43,7 +43,10 @@ function stormperson_list() {
   $args = array();
   $filterfields = array();
 
-  $s  = "SELECT n.*, spe.* FROM {node} AS n INNER JOIN {stormperson} AS spe ON n.vid=spe.vid WHERE n.status=1 AND n.type='stormperson' ";
+  $s  = "SELECT n.*, spe.*, nre.format FROM {node} AS n
+    INNER JOIN {stormperson} AS spe ON n.vid=spe.vid
+    INNER JOIN {node_revisions} AS nre ON n.vid = nre.vid
+    WHERE n.status=1 AND n.type='stormperson' ";
   if (isset($_SESSION['stormperson_list_filter']['organization_nid']) && $_SESSION['stormperson_list_filter']['organization_nid'] != 0) {
     $where[] = 'spe.organization_nid=%d';
     $args[] = $_SESSION['stormperson_list_filter']['organization_nid'];
diff --git a/stormperson/stormperson.test b/stormperson/stormperson.test
index b6c2032..8605242 100644
--- a/stormperson/stormperson.test
+++ b/stormperson/stormperson.test
@@ -48,4 +48,177 @@ class StormpersonTestCase extends DrupalWebTestCase {
     $this->drupalPost('node/add/stormperson', $person, t('Save'));
     $this->assertText(t('Person @title has been created.', array('@title' => $person['title'])));
   }
+
+  public function testStormpersonList() {
+    // Create and login user
+    $userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view all', 'Storm person: edit all', 'Storm person: delete all'));
+    $userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view of user organization', 'Storm person: edit of user organization', 'Storm person: delete of user organization'));
+    $userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view own', 'Storm person: edit own', 'Storm person: delete own'));
+    $userLinked = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view when linked to own user account', 'Storm person: edit when linked to own user account', 'Storm person: delete when linked to own user account'));
+    $userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view all', 'Storm person: edit own', 'Storm person: delete own'));
+
+    $this->drupalLogin($userAll);
+
+    // Create organization
+    $org = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org, t('Save'));
+    $org = node_load(array('title' => $org['title']));
+
+    // Create organization
+    $org2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org2, t('Save'));
+    $org2 = node_load(array('title' => $org2['title']));
+
+    // Create stormperson with organization to userOrg
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userOrg->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+
+    // Create persons
+    $person1 = array(
+      'organization_nid' => $org->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormperson', $person1, t('Save'));
+    $person1 = node_load(array('title' => $person1['title']));
+
+    $person4 = array(
+      'organization_nid' => $org->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'user_name' => $userLinked->name,
+    );
+    $this->drupalPost('node/add/stormperson', $person4, t('Save'));
+    $person4 = node_load(array('title' => $person4['title']));
+
+    $this->drupalLogin($userOwn);
+    $person2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+    );
+    $this->drupalPost('node/add/stormperson', $person2, t('Save'));
+    $person2 = node_load(array('title' => $person2['title']));
+
+    $this->drupalLogin($userViewAllEditOwn);
+    $person3 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org2->nid,
+    );
+    $this->drupalPost('node/add/stormperson', $person3, t('Save'));
+    $person3 = node_load(array('title' => $person3['title']));
+
+    // Test for 'Storm person: view all'
+    $this->drupalLogin($userAll);
+    $this->drupalGet('storm/people');
+
+    $this->assertLink($person1->title, 0, 'The Person appears on the list');
+    $this->assertRaw('node/'.$person1->nid.'/edit', 'The Person edit icon appears on the list');
+    $this->assertRaw('node/'.$person1->nid.'/delete', 'The Person edit icon appears on the list');
+
+    $this->assertLink($person2->title, 0, 'The Person appears on the list');
+    $this->assertRaw('node/'.$person2->nid.'/edit', 'The Person edit icon appears on the list');
+    $this->assertRaw('node/'.$person2->nid.'/delete', 'The Person edit icon appears on the list');
+
+    $this->assertLink($person3->title, 0, 'The Person appears on the list');
+    $this->assertRaw('node/'.$person3->nid.'/edit', 'The Person edit icon appears on the list');
+    $this->assertRaw('node/'.$person3->nid.'/delete', 'The Person edit icon appears on the list');
+
+    $this->assertLink($person4->title, 0, 'The Person appears on the list');
+    $this->assertRaw('node/'.$person4->nid.'/edit', 'The Person edit icon appears on the list');
+    $this->assertRaw('node/'.$person4->nid.'/delete', 'The Person edit icon appears on the list');
+
+    // Test for 'Storm person: view of user organization'
+    $this->drupalLogin($userOrg);
+    $this->drupalGet('storm/people');
+
+    $this->assertLink($person1->title, 0, 'The Person appears on the list');
+    $this->assertRaw('node/'.$person1->nid.'/edit', 'The Person edit icon appears on the list');
+    $this->assertRaw('node/'.$person1->nid.'/delete', 'The Person edit icon appears on the list');
+
+    $this->assertLink($person2->title, 0, 'The Person appears on the list');
+    $this->assertRaw('node/'.$person2->nid.'/edit', 'The Person edit icon appears on the list');
+    $this->assertRaw('node/'.$person2->nid.'/delete', 'The Person edit icon appears on the list');
+
+    $this->assertNoLink($person3->title, 'The Person appears not on the list');
+    $this->assertNoRaw('node/'.$person3->nid.'/edit', 'The Person edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$person3->nid.'/delete', 'The Person edit icon does not appear on the list');
+
+    $this->assertLink($person4->title, 0, 'The Person appears on the list');
+    $this->assertRaw('node/'.$person4->nid.'/edit', 'The Person edit icon appears on the list');
+    $this->assertRaw('node/'.$person4->nid.'/delete', 'The Person edit icon appears on the list');
+
+    // Test for 'Storm person: view own'
+    $this->drupalLogin($userOwn);
+    $this->drupalGet('storm/people');
+
+    $this->assertNoLink($person1->title, 'The Person appears not on the list');
+    $this->assertNoRaw('node/'.$person1->nid.'/edit', 'The Person edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$person1->nid.'/delete', 'The Person edit icon does not appear on the list');
+
+    $this->assertLink($person2->title, 0, 'The Person appears on the list');
+    $this->assertRaw('node/'.$person2->nid.'/edit', 'The Person edit icon appears on the list');
+    $this->assertRaw('node/'.$person2->nid.'/delete', 'The Person edit icon appears on the list');
+
+    $this->assertNoLink($person3->title, 'The Person appears not on the list');
+    $this->assertNoRaw('node/'.$person3->nid.'/edit', 'The Person edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$person3->nid.'/delete', 'The Person edit icon does not appear on the list');
+
+    $this->assertNoLink($person4->title, 'The Person appears not on the list');
+    $this->assertNoRaw('node/'.$person4->nid.'/edit', 'The Person edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$person4->nid.'/delete', 'The Person edit icon does not appear on the list');
+
+    // Test for 'Storm person: view all', 'Storm invoice: edit own'
+    $this->drupalLogin($userViewAllEditOwn);
+    $this->drupalGet('storm/people');
+
+    $this->assertLink($person1->title, 0, 'The Person appears on the list');
+    $this->assertNoRaw('node/'.$person1->nid.'/edit', 'The Person edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$person1->nid.'/delete', 'The Person edit icon does not appear on the list');
+
+    $this->assertLink($person2->title, 0, 'The Person appears on the list');
+    $this->assertNoRaw('node/'.$person2->nid.'/edit', 'The Person edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$person2->nid.'/delete', 'The Person edit icon does not appear on the list');
+
+    $this->assertLink($person3->title, 0, 'The Person appears on the list');
+    $this->assertRaw('node/'.$person3->nid.'/edit', 'The Person edit icon appears on the list');
+    $this->assertRaw('node/'.$person3->nid.'/delete', 'The Person edit icon appears on the list');
+
+    $this->assertLink($person4->title, 0, 'The Person appears on the list');
+    $this->assertNoRaw('node/'.$person4->nid.'/edit', 'The Person edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$person4->nid.'/delete', 'The Person edit icon does not appear on the list');
+
+    // Test for 'Storm person: view when linked to own user account'
+    $this->drupalLogin($userLinked);
+    $this->drupalGet('storm/people');
+
+    $this->assertNoLink($person1->title, 'The Person appears not on the list');
+    $this->assertNoRaw('node/'.$person1->nid.'/edit', 'The Person edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$person1->nid.'/delete', 'The Person edit icon does not appear on the list');
+
+    $this->assertNoLink($person2->title, 'The Person appears not on the list');
+    $this->assertNoRaw('node/'.$person2->nid.'/edit', 'The Person edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$person2->nid.'/delete', 'The Person edit icon does not appear on the list');
+
+    $this->assertNoLink($person3->title, 'The Person appears not on the list');
+    $this->assertNoRaw('node/'.$person3->nid.'/edit', 'The Person edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$person3->nid.'/delete', 'The Person edit icon does not appear on the list');
+
+    $this->assertLink($person4->title, 0, 'The Person appears on the list');
+    $this->assertRaw('node/'.$person4->nid.'/edit', 'The Person edit icon does not appear on the list');
+    $this->assertRaw('node/'.$person4->nid.'/delete', 'The Person edit icon does not appear on the list');
+
+  }
 }
diff --git a/stormperson/stormperson.theme.inc b/stormperson/stormperson.theme.inc
index 185bf1b..2cdc03d 100644
--- a/stormperson/stormperson.theme.inc
+++ b/stormperson/stormperson.theme.inc
@@ -7,19 +7,12 @@
 function theme_stormperson_list($header, $people) {
   $rows = array();
   foreach ($people as $person) {
-    $n = new stdClass();
-    $n->nid = $person->nid;
-    $n->uid = $person->uid;
-    $n->user_uid = $person->user_uid;
-    $n->organization_nid = $person->organization_nid;
-    $n->type = 'stormperson';
-
     $rows[] = array(
       l($person->organization_title, 'node/'. $person->organization_nid),
       l($person->title, 'node/'. $person->nid) . theme('mark', node_mark($person->nid, $person->changed)),
       l($person->email, 'mailto:'. $person->email),
       array(
-        'data' => storm_icon_edit_node($n, $_GET) .'&nbsp;'. storm_icon_delete_node($n, $_GET),
+        'data' => storm_icon_edit_node($person, $_GET) .'&nbsp;'. storm_icon_delete_node($person, $_GET),
         'class' => 'storm_list_operations',
       ),
     );
diff --git a/stormproject/stormproject.admin.inc b/stormproject/stormproject.admin.inc
index 9be82d5..71b79bc 100644
--- a/stormproject/stormproject.admin.inc
+++ b/stormproject/stormproject.admin.inc
@@ -45,7 +45,10 @@ function stormproject_list() {
     ),
   );
 
-  $s  = "SELECT n.*, spr.* FROM {node} AS n INNER JOIN {stormproject} AS spr ON n.vid=spr.vid WHERE n.status=1 AND n.type='stormproject'";
+  $s  = "SELECT n.*, spr.*, nre.format FROM {node} AS n
+    INNER JOIN {stormproject} AS spr ON n.vid=spr.vid
+    INNER JOIN {node_revisions} AS nre ON n.vid = nre.vid
+    WHERE n.status=1 AND n.type='stormproject'";
 
   $where = array();
   $args = array();
diff --git a/stormproject/stormproject.module b/stormproject/stormproject.module
index 021e8c6..16db2cc 100644
--- a/stormproject/stormproject.module
+++ b/stormproject/stormproject.module
@@ -93,13 +93,13 @@ function stormproject_access($op, $node, $account=NULL) {
     elseif (user_access('Storm project: delete if project manager') && ($account->stormperson_nid == $node->manager_nid)) {
       return TRUE;
     }
-    elseif (user_access('Storm project: delete if assigned to project' && ($account->stormperson_nid == $node->assigned_nid))) {
+    elseif (user_access('Storm project: delete if assigned to project') && ($account->stormperson_nid == $node->assigned_nid)) {
       return TRUE;
     }
-    elseif (user_access('Storm project: delete if assigned to project' && module_exists('stormteam') && stormteam_user_belongs_to_team($node->assigned_nid, $account->stormperson_nid))) {
+    elseif (user_access('Storm project: delete if assigned to project') && module_exists('stormteam') && stormteam_user_belongs_to_team($node->assigned_nid, $account->stormperson_nid)) {
       return TRUE;
     }
-    elseif (user_access('Storm project: delete if assigned to project' && module_exists('stormteam') && stormteam_user_belongs_to_team($node->assigned_nid, $account->stormorganization_nid))) {
+    elseif (user_access('Storm project: delete if assigned to project') && module_exists('stormteam') && stormteam_user_belongs_to_team($node->assigned_nid, $account->stormorganization_nid)) {
       return TRUE;
     }
   }
@@ -180,7 +180,7 @@ function stormproject_access_sql($sql, $where = array()) {
 
     if (module_exists('stormteam')) {
       // Load teams that the account belongs to
-      $belonged_teams = stormteam_user_return_teams($account);
+      $belonged_teams = stormteam_user_return_teams();
       // Allow access if any of those teams is the one in question
       foreach ($belonged_teams as $belonged_team) {
         $cond .= ' OR spr.assigned_nid = '. $belonged_team;
@@ -343,10 +343,10 @@ function stormproject_form(&$node) {
     $node->datebegin = time();
     $node->dateend = time();
 
-    if (array_key_exists('organization_nid', $_GET) && !$node->organization) {
+    if (array_key_exists('organization_nid', $_GET) && empty($node->organization_nid)) {
       $node->organization_nid = $_GET['organization_nid'];
     }
-    if (isset($_SESSION['stormproject_list_filter']['organization_nid']) && !$node->organization_nid) {
+    if (isset($_SESSION['stormproject_list_filter']['organization_nid']) && empty($node->organization_nid)) {
       $node->organization_nid = $_SESSION['stormproject_list_filter']['organization_nid'];
     }
     $s_org = "SELECT n.nid, n.title FROM {stormorganization} so INNER JOIN {node} n
@@ -588,11 +588,13 @@ function stormproject_insert($node) {
   $r = db_query($s, $node->manager_nid);
   $manager = db_fetch_object($r);
   if (!$manager) {
+    $manager = new stdClass();
     $manager->title = '';
   }
 
   $assigned = node_load($node->assigned_nid);
   if (!$assigned) {
+    $assigned = new stdClass();
     $assigned->title = '';
   }
 
diff --git a/stormproject/stormproject.test b/stormproject/stormproject.test
index b76da1d..7a6c869 100644
--- a/stormproject/stormproject.test
+++ b/stormproject/stormproject.test
@@ -14,7 +14,7 @@ class StormprojectTestCase extends DrupalWebTestCase {
   }
 
   public function setUp() {
-    parent::setUp('storm', 'stormorganization', 'stormproject');
+    parent::setUp('storm', 'stormorganization', 'stormproject', 'stormperson', 'stormteam');
   }
 
   public function testStormprojectAccess() {
@@ -51,4 +51,326 @@ class StormprojectTestCase extends DrupalWebTestCase {
 
     $this->assertText(t('Project @title has been created.', array('@title' => $prj['title'])));;
   }
+
+  public function testStormprojectList() {
+    // Create and login user
+    $userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view all', 'Storm project: edit all', 'Storm project: delete all', 'Storm person: add', 'Storm team: add', 'Storm person: view all', 'Storm team: view all'));
+    $userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view of user organization', 'Storm project: edit of user organization', 'Storm project: delete of user organization'));
+    $userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view own', 'Storm project: edit own', 'Storm project: delete own'));
+    $userManager = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view if project manager', 'Storm project: edit if project manager', 'Storm project: delete if project manager'));
+    $userAssigned = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view if assigned to project', 'Storm project: edit if assigned to project', 'Storm project: delete if assigned to project'));
+    $userAssignedTeam = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view if assigned to project', 'Storm project: edit if assigned to project', 'Storm project: delete if assigned to project'));
+    $userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view all', 'Storm project: edit own', 'Storm project: delete own'));
+
+    $this->drupalLogin($userAll);
+
+    // Create organization
+    $org = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org, t('Save'));
+    $org = node_load(array('title' => $org['title']));
+
+    // Create organization
+    $org2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org2, t('Save'));
+    $org2 = node_load(array('title' => $org2['title']));
+
+    // Create stormperson with organization to userOrg
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userOrg->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userManager->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+    $manager = node_load(array('title' => $personOrg['title']));
+
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userAssigned->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+    $assignedPerson = node_load(array('title' => $personOrg['title']));
+
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userAssignedTeam->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+    $assignedPersonTeam = node_load(array('title' => $personOrg['title']));
+
+    $team = array(
+      'title' => $this->randomName(32),
+      'members_array_1' => $assignedPersonTeam->nid,
+    );
+    $this->drupalPost('node/add/stormteam', $team, t('Save'));
+    $team = node_load(array('title' => $team['title']));
+
+    // Create project
+    $project1 = array(
+      'organization_nid' => $org->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormproject', $project1, t('Save'));
+    $project1 = node_load(array('title' => $project1['title']));
+
+    $projectManager = array(
+      'organization_nid' => $org->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'manager_nid' => $manager->nid,
+    );
+    $this->drupalPost('node/add/stormproject', $projectManager, t('Save'));
+    $projectManager = node_load(array('title' => $projectManager['title']));
+
+    $projectAssigned = array(
+      'organization_nid' => $org->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'assigned_nid' => $assignedPerson->nid,
+    );
+    $this->drupalPost('node/add/stormproject', $projectAssigned, t('Save'));
+    $projectAssigned = node_load(array('title' => $projectAssigned['title']));
+
+    $projectAssignedTeam = array(
+      'organization_nid' => $org->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'assigned_nid' => $team->nid,
+    );
+    $this->drupalPost('node/add/stormproject', $projectAssignedTeam, t('Save'));
+    $projectAssignedTeam = node_load(array('title' => $projectAssignedTeam['title']));
+
+    $this->drupalLogin($userOwn);
+    $project2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+    );
+    $this->drupalPost('node/add/stormproject', $project2, t('Save'));
+    $project2 = node_load(array('title' => $project2['title']));
+
+    $this->drupalLogin($userViewAllEditOwn);
+    $project3 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org2->nid,
+    );
+    $this->drupalPost('node/add/stormproject', $project3, t('Save'));
+    $project3 = node_load(array('title' => $project3['title']));
+
+    // Test for 'Storm project: view all'
+    $this->drupalLogin($userAll);
+    $this->drupalGet('storm/projects');
+
+    $this->assertLink($project1->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$project1->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$project1->nid.'/delete', 'The Project delete icon appears on the list');
+
+    $this->assertLink($project2->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$project2->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$project2->nid.'/delete', 'The Project delete icon appears on the list');
+
+    $this->assertLink($project3->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$project3->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$project3->nid.'/delete', 'The Project delete icon appears on the list');
+
+    $this->assertLink($projectManager->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$projectManager->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$projectManager->nid.'/delete', 'The Project delete icon appears on the list');
+
+    $this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$projectAssigned->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$projectAssigned->nid.'/delete', 'The Project delete icon appears on the list');
+
+    $this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$projectAssignedTeam->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$projectAssignedTeam->nid.'/delete', 'The Project delete icon appears on the list');
+
+    // Test for 'Storm project: view of user organization'
+    $this->drupalLogin($userOrg);
+    $this->drupalGet('storm/projects');
+
+    $this->assertLink($project1->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$project1->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$project1->nid.'/delete', 'The Project delete icon appears on the list');
+
+    $this->assertLink($project2->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$project2->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$project2->nid.'/delete', 'The Project delete icon appears on the list');
+
+    $this->assertNoLink($project3->title, 0, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$project3->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project3->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertLink($projectManager->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$projectManager->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$projectManager->nid.'/delete', 'The Project delete icon appears on the list');
+
+    $this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$projectAssigned->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$projectAssigned->nid.'/delete', 'The Project delete icon appears on the list');
+
+    $this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$projectAssignedTeam->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$projectAssignedTeam->nid.'/delete', 'The Project delete icon appears on the list');
+
+    // Test for 'Storm project: view own'
+    $this->drupalLogin($userOwn);
+    $this->drupalGet('storm/projects');
+
+    $this->assertNoLink($project1->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$project1->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project1->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertLink($project2->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$project2->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$project2->nid.'/delete', 'The Project delete icon appears on the list');
+
+    $this->assertNoLink($project3->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$project3->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project3->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertNoLink($projectManager->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$projectManager->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$projectManager->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertNoLink($projectAssigned->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$projectAssigned->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$projectAssigned->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertNoLink($projectAssignedTeam->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$projectAssignedTeam->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$projectAssignedTeam->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    // Test for 'Storm project: view all', 'Storm project: edit own'
+    $this->drupalLogin($userViewAllEditOwn);
+    $this->drupalGet('storm/projects');
+
+    $this->assertLink($project1->title, 0, 'The Project appears on the list');
+    $this->assertNoRaw('node/'.$project1->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project1->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertLink($project2->title, 0, 'The Project appears on the list');
+    $this->assertNoRaw('node/'.$project2->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project2->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertLink($project3->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$project3->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$project3->nid.'/delete', 'The Project delete icon appears on the list');
+
+    $this->assertLink($projectManager->title, 0, 'The Project appears on the list');
+    $this->assertNoRaw('node/'.$projectManager->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$projectManager->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
+    $this->assertNoRaw('node/'.$projectAssigned->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$projectAssigned->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
+    $this->assertNoRaw('node/'.$projectAssignedTeam->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$projectAssignedTeam->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    // Test for 'Storm project: view if project manager'
+    $this->drupalLogin($userManager);
+    $this->drupalGet('storm/projects');
+
+    $this->assertNoLink($project1->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$project1->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project1->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertNoLink($project2->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$project2->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project2->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertNoLink($project3->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$project3->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project3->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertLink($projectManager->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$projectManager->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$projectManager->nid.'/delete', 'The Project delete icon appears on the list');
+
+    $this->assertNoLink($projectAssigned->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$projectAssigned->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$projectAssigned->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertNoLink($projectAssignedTeam->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$projectAssignedTeam->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$projectAssignedTeam->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    // Test for 'Storm project: view if assigned to project'
+    $this->drupalLogin($userAssigned);
+    $this->drupalGet('storm/projects');
+
+    $this->assertNoLink($project1->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$project1->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project1->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertNoLink($project2->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$project2->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project2->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertNoLink($project3->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$project3->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project3->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertNoLink($projectManager->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$projectManager->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$projectManager->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$projectAssigned->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$projectAssigned->nid.'/delete', 'The Project delete icon appears on the list');
+
+    $this->assertNoLink($projectAssignedTeam->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$projectAssignedTeam->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$projectAssignedTeam->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    // Test for 'Storm project: view if assigned to project' (using team)
+    $this->drupalLogin($userAssignedTeam);
+    $this->drupalGet('storm/projects');
+
+    $this->assertNoLink($project1->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$project1->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project1->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertNoLink($project2->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$project2->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project2->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertNoLink($project3->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$project3->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$project3->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertNoLink($projectManager->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$projectManager->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$projectManager->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertNoLink($projectAssigned->title, 'The Project appears not on the list');
+    $this->assertNoRaw('node/'.$projectAssigned->nid.'/edit', 'The Project edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$projectAssigned->nid.'/delete', 'The Project delete icon appears not on the list');
+
+    $this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
+    $this->assertRaw('node/'.$projectAssignedTeam->nid.'/edit', 'The Project edit icon appears on the list');
+    $this->assertRaw('node/'.$projectAssignedTeam->nid.'/delete', 'The Project delete icon appears on the list');
+  }
 }
diff --git a/stormtask/stormtask.admin.inc b/stormtask/stormtask.admin.inc
index 988d3d6..d6cb87d 100644
--- a/stormtask/stormtask.admin.inc
+++ b/stormtask/stormtask.admin.inc
@@ -483,7 +483,10 @@ function stormtask_list() {
   $args = array();
   $filterfields = array();
 
-  $s  = "SELECT n.*, sta.* FROM {node} AS n INNER JOIN {stormtask} AS sta ON n.vid=sta.vid WHERE n.status=1 AND n.type='stormtask' ";
+  $s  = "SELECT n.*, sta.*, nre.format FROM {node} AS n
+    INNER JOIN {stormtask} AS sta ON n.vid=sta.vid
+    INNER JOIN {node_revisions} AS nre ON n.vid = nre.vid
+    WHERE n.status=1 AND n.type='stormtask' ";
   if (isset($_SESSION['stormtask_list_filter']['organization_nid']) && ($_SESSION['stormtask_list_filter']['organization_nid'] != 0)) {
     $where[] = 'sta.organization_nid=%d';
     $args[] = $_SESSION['stormtask_list_filter']['organization_nid'];
diff --git a/stormtask/stormtask.module b/stormtask/stormtask.module
index 6ac6fae..438f8ac 100644
--- a/stormtask/stormtask.module
+++ b/stormtask/stormtask.module
@@ -72,13 +72,13 @@ function stormtask_access($op, $node, $account=NULL) {
     elseif (user_access('Storm task: delete of user organization') && ($account->stormorganization_nid == $node->organization_nid)) {
       return TRUE;
     }
-    elseif (user_access('Storm task: delete if assigned to task' && ($account->stormperson_nid == $node->assigned_nid))) {
+    elseif (user_access('Storm task: delete if assigned to task') && ($account->stormperson_nid == $node->assigned_nid)) {
       return TRUE;
     }
-    elseif (user_access('Storm task: delete if assigned to task' && module_exists('stormteam') && stormteam_user_belongs_to_team($node->assigned_nid, $account->stormperson_nid))) {
+    elseif (user_access('Storm task: delete if assigned to task') && module_exists('stormteam') && stormteam_user_belongs_to_team($node->assigned_nid, $account->stormperson_nid)) {
       return TRUE;
     }
-    elseif (user_access('Storm task: delete if assigned to task' && module_exists('stormteam') && stormteam_user_belongs_to_team($node->assigned_nid, $account->stormorganization_nid))) {
+    elseif (user_access('Storm task: delete if assigned to task') && module_exists('stormteam') && stormteam_user_belongs_to_team($node->assigned_nid, $account->stormorganization_nid)) {
       return TRUE;
     }
   }
@@ -149,7 +149,7 @@ function stormtask_access_sql($sql, $where = array()) {
 
     if (module_exists('stormteam')) {
       // Load teams that the account belongs to
-      $belonged_teams = stormteam_user_return_teams($account);
+      $belonged_teams = stormteam_user_return_teams();
       // Allow access if any of those teams is the one in question
       foreach ($belonged_teams as $belonged_team) {
         $cond .= ' OR sta.assigned_nid = '. $belonged_team;
@@ -421,10 +421,10 @@ function stormtask_form(&$node) {
     $node->datebegin = time();
     $node->dateend = time();
 
-    if (array_key_exists('organization_nid', $_GET) && !$node->organization_nid) {
+    if (array_key_exists('organization_nid', $_GET) && empty($node->organization_nid)) {
       $node->organization_nid = $_GET['organization_nid'];
     }
-    if (array_key_exists('project_nid', $_GET) && !$node->project_nid) {
+    if (array_key_exists('project_nid', $_GET) && empty($node->project_nid)) {
       $node->project_nid = $_GET['project_nid'];
       $p = node_load($node->project_nid);
       // Ensure that the correct organization is loaded
@@ -434,7 +434,7 @@ function stormtask_form(&$node) {
         drupal_goto('node/'. $node->project_nid);
       }
     }
-    if (array_key_exists('task_nid', $_GET) && !$node->parent_nid) {
+    if (array_key_exists('task_nid', $_GET) && empty($node->parent_nid)) {
       // Parent task can be autoloaded by use of ?task_nid=string
       $node->parent_nid = $_GET['task_nid'];
       $t = node_load($node->parent_nid);
@@ -895,7 +895,7 @@ function _stormtask_get_tree($project_nid, $parent_nid = 0, $depth = -1, $max_de
         $task->depth = $depth;
         $task->parents = $parents[$project_nid][$child_nid];
         $tree[] = $task;
-        if ($children[$project_nid][$child_nid]) {
+        if (isset($children[$project_nid][$child_nid])) {
           $tree = array_merge($tree, _stormtask_get_tree($project_nid, $child_nid, $depth, $max_depth, $where, $args));
         }
       }
diff --git a/stormtask/stormtask.test b/stormtask/stormtask.test
index 5c977c2..9bb47c8 100644
--- a/stormtask/stormtask.test
+++ b/stormtask/stormtask.test
@@ -14,7 +14,7 @@ class StormtaskTestCase extends DrupalWebTestCase {
   }
 
   public function setUp() {
-    parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask');
+    parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormperson', 'stormteam');
   }
 
   public function testStormtaskAccess() {
@@ -56,4 +56,283 @@ class StormtaskTestCase extends DrupalWebTestCase {
 
     $this->assertText(t('Task @title has been created.', array('@title' => $task['title'])));;
   }
+
+  public function testStormtaskList() {
+    // Create and login user
+    $userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view all', 'Storm task: edit all', 'Storm task: delete all', 'Storm person: add', 'Storm team: add', 'Storm person: view all', 'Storm team: view all', 'Storm project: add', 'Storm project: view all'));
+    $userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view of user organization', 'Storm task: edit of user organization', 'Storm task: delete of user organization'));
+    $userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view own', 'Storm task: edit own', 'Storm task: delete own', 'Storm project: view all'));
+    $userAssigned = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view if assigned to task', 'Storm task: edit if assigned to task', 'Storm task: delete if assigned to task'));
+    $userAssignedTeam = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view if assigned to task', 'Storm task: edit if assigned to task', 'Storm task: delete if assigned to task'));
+    $userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view all', 'Storm task: edit own', 'Storm task: delete own', 'Storm project: view all'));
+
+    $this->drupalLogin($userAll);
+
+    // Create organization
+    $org = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org, t('Save'));
+    $org = node_load(array('title' => $org['title']));
+
+    $org2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org2, t('Save'));
+    $org2 = node_load(array('title' => $org2['title']));
+
+    // Create stormperson with organization to userOrg
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userOrg->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userAssigned->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+    $assignedPerson = node_load(array('title' => $personOrg['title']));
+
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userAssignedTeam->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+    $assignedPersonTeam = node_load(array('title' => $personOrg['title']));
+
+    $team = array(
+      'title' => $this->randomName(32),
+      'members_array_1' => $assignedPersonTeam->nid,
+    );
+    $this->drupalPost('node/add/stormteam', $team, t('Save'));
+    $team = node_load(array('title' => $team['title']));
+
+    // Create project foreach organization
+    $prj = array(
+      'title' => $this->randomName(32),
+      'organization_nid' => $org->nid,
+    );
+    $this->drupalPost('node/add/stormproject', $prj, t('Save'));
+    $projectOrg = node_load(array('title' => $prj['title']));
+
+    $prj = array(
+      'title' => $this->randomName(32),
+      'organization_nid' => $org->nid,
+      'assigned_nid' => $team->nid,
+    );
+    $this->drupalPost('node/add/stormproject', $prj, t('Save'));
+    $projectTeam = node_load(array('title' => $prj['title']));
+
+    $prj = array(
+      'title' => $this->randomName(32),
+      'organization_nid' => $org2->nid,
+      'assigned_nid' => $team->nid,
+    );
+    $this->drupalPost('node/add/stormproject', $prj, t('Save'));
+    $projectOrg2 = node_load(array('title' => $prj['title']));
+
+    // Create tasks
+    $task1 = array(
+      'organization_nid' => $org->nid,
+      'project_nid' => $projectOrg->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormtask', $task1, t('Save'), array('query' => 'organization_nid='.$org->nid));
+    $task1 = node_load(array('title' => $task1['title']));
+
+    $taskAssigned = array(
+      'organization_nid' => $org->nid,
+      'project_nid' => $projectOrg->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'assigned_nid' => $assignedPerson->nid,
+    );
+    $this->drupalPost('node/add/stormtask', $taskAssigned, t('Save'), array('query' => 'organization_nid='.$org->nid.'&project_nid='.$projectOrg->nid));
+    $taskAssigned = node_load(array('title' => $taskAssigned['title']));
+
+    $taskAssignedTeam = array(
+      'organization_nid' => $org->nid,
+      'project_nid' => $projectTeam->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'assigned_nid' => $team->nid,
+    );
+    $this->drupalPost('node/add/stormtask', $taskAssignedTeam, t('Save'), array('query' => 'organization_nid='.$org->nid.'&project_nid='.$projectTeam->nid));
+    $taskAssignedTeam = node_load(array('title' => $taskAssignedTeam['title']));
+
+    $this->drupalLogin($userOwn);
+    $task2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'project_nid' => $projectOrg->nid,
+    );
+    $this->drupalPost('node/add/stormtask', $task2, t('Save'), array('query' => 'organization_nid='.$org->nid));
+    $task2 = node_load(array('title' => $task2['title']));
+
+    $this->drupalLogin($userViewAllEditOwn);
+    $task3 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org2->nid,
+      'project_nid' => $projectOrg2->nid,
+    );
+    $this->drupalPost('node/add/stormtask', $task3, t('Save'), array('query' => 'organization_nid='.$org2->nid));
+    $task3 = node_load(array('title' => $task3['title']));
+
+    // Test for 'Storm task: view all'
+    $this->drupalLogin($userAll);
+    $this->drupalGet('storm/tasks');
+
+    $this->assertLink($task1->title, 0, 'The Task appears on the list');
+    $this->assertRaw('node/'.$task1->nid.'/edit', 'The Task edit icon appears on the list');
+    $this->assertRaw('node/'.$task1->nid.'/delete', 'The Task delete icon appears on the list');
+
+    $this->assertLink($task2->title, 0, 'The Task appears on the list');
+    $this->assertRaw('node/'.$task2->nid.'/edit', 'The Task edit icon appears on the list');
+    $this->assertRaw('node/'.$task2->nid.'/delete', 'The Task delete icon appears on the list');
+
+    $this->assertLink($task3->title, 0, 'The Task appears on the list');
+    $this->assertRaw('node/'.$task3->nid.'/edit', 'The Task edit icon appears on the list');
+    $this->assertRaw('node/'.$task3->nid.'/delete', 'The Task delete icon appears on the list');
+
+    $this->assertLink($taskAssigned->title, 0, 'The Task appears on the list');
+    $this->assertRaw('node/'.$taskAssigned->nid.'/edit', 'The Task edit icon appears on the list');
+    $this->assertRaw('node/'.$taskAssigned->nid.'/delete', 'The Task delete icon appears on the list');
+
+    $this->assertLink($taskAssignedTeam->title, 0, 'The Task appears on the list');
+    $this->assertRaw('node/'.$taskAssignedTeam->nid.'/edit', 'The Task edit icon appears on the list');
+    $this->assertRaw('node/'.$taskAssignedTeam->nid.'/delete', 'The Task delete icon appears on the list');
+
+    // Test for 'Storm task: view of user organization'
+    $this->drupalLogin($userOrg);
+    $this->drupalGet('storm/tasks');
+
+    $this->assertLink($task1->title, 0, 'The Task appears on the list');
+    $this->assertRaw('node/'.$task1->nid.'/edit', 'The Task edit icon appears on the list');
+    $this->assertRaw('node/'.$task1->nid.'/delete', 'The Task delete icon appears on the list');
+
+    $this->assertLink($task2->title, 0, 'The Task appears on the list');
+    $this->assertRaw('node/'.$task2->nid.'/edit', 'The Task edit icon appears on the list');
+    $this->assertRaw('node/'.$task2->nid.'/delete', 'The Task delete icon appears on the list');
+
+    $this->assertNoLink($task3->title, 'The Task appears not on the list');
+    $this->assertNoRaw('node/'.$task3->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$task3->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    $this->assertLink($taskAssigned->title, 0, 'The Task appears on the list');
+    $this->assertRaw('node/'.$taskAssigned->nid.'/edit', 'The Task edit icon appears on the list');
+    $this->assertRaw('node/'.$taskAssigned->nid.'/delete', 'The Task delete icon appears on the list');
+
+    $this->assertLink($taskAssignedTeam->title, 0, 'The Task appears on the list');
+    $this->assertRaw('node/'.$taskAssignedTeam->nid.'/edit', 'The Task edit icon appears on the list');
+    $this->assertRaw('node/'.$taskAssignedTeam->nid.'/delete', 'The Task delete icon appears on the list');
+
+    // Test for 'Storm task: view own'
+    $this->drupalLogin($userOwn);
+    $this->drupalGet('storm/tasks');
+
+    $this->assertNoLink($task1->title, 'The Task appears not on the list');
+    $this->assertNoRaw('node/'.$task1->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$task1->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    $this->assertLink($task2->title, 0, 'The Task appears on the list');
+    $this->assertRaw('node/'.$task2->nid.'/edit', 'The Task edit icon appears on the list');
+    $this->assertRaw('node/'.$task2->nid.'/delete', 'The Task delete icon appears on the list');
+
+    $this->assertNoLink($task3->title, 'The Task appears not on the list');
+    $this->assertNoRaw('node/'.$task3->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$task3->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    $this->assertNoLink($taskAssigned->title, 'The Task appears not on the list');
+    $this->assertNoRaw('node/'.$taskAssigned->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$taskAssigned->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    $this->assertNoLink($taskAssignedTeam->title, 'The Task appears not on the list');
+    $this->assertNoRaw('node/'.$taskAssignedTeam->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$taskAssignedTeam->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    // Test for 'Storm task: view all', 'Storm task: edit own'
+    $this->drupalLogin($userViewAllEditOwn);
+    $this->drupalGet('storm/tasks');
+
+    $this->assertLink($task1->title, 0, 'The Task appears on the list');
+    $this->assertNoRaw('node/'.$task1->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$task1->nid.'/delete', 'The Task edit icon does not appear on the list');
+
+    $this->assertLink($task2->title, 0, 'The Task appears on the list');
+    $this->assertNoRaw('node/'.$task2->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$task2->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    $this->assertLink($task3->title, 0, 'The Task appears on the list');
+    $this->assertRaw('node/'.$task3->nid.'/edit', 'The Task edit icon appears on the list');
+    $this->assertRaw('node/'.$task3->nid.'/delete', 'The Task delete icon appears on the list');
+
+    $this->assertLink($taskAssigned->title, 0, 'The Task appears on the list');
+    $this->assertNoRaw('node/'.$taskAssigned->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$taskAssigned->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    $this->assertLink($taskAssignedTeam->title, 0, 'The Task appears on the list');
+    $this->assertNoRaw('node/'.$taskAssignedTeam->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$taskAssignedTeam->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    // Test for 'Storm task: view if assigned to task'
+    $this->drupalLogin($userAssigned);
+    $this->drupalGet('storm/tasks');
+
+    $this->assertNoLink($task1->title, 'The Task appears not on the list');
+    $this->assertNoRaw('node/'.$task1->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$task1->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    $this->assertNoLink($task2->title, 'The Task appears not on the list');
+    $this->assertNoRaw('node/'.$task2->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$task2->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    $this->assertNoLink($task3->title, 'The Task appears not on the list');
+    $this->assertNoRaw('node/'.$task3->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$task3->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    $this->assertLink($taskAssigned->title, 0, 'The Task appears on the list');
+    $this->assertRaw('node/'.$taskAssigned->nid.'/edit', 'The Task edit icon appears on the list');
+    $this->assertRaw('node/'.$taskAssigned->nid.'/delete', 'The Task delete icon appears on the list');
+
+    $this->assertNoLink($taskAssignedTeam->title, 'The Task appears not on the list');
+    $this->assertNoRaw('node/'.$taskAssignedTeam->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$taskAssignedTeam->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    // Test for 'Storm task: view if assigned to task' (using team)
+    $this->drupalLogin($userAssignedTeam);
+    $this->drupalGet('storm/tasks');
+
+    $this->assertNoLink($task1->title, 'The Task appears not on the list');
+    $this->assertNoRaw('node/'.$task1->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$task1->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    $this->assertNoLink($task2->title, 'The Task appears not on the list');
+    $this->assertNoRaw('node/'.$task2->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$task2->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    $this->assertNoLink($task3->title, 'The Task appears not on the list');
+    $this->assertNoRaw('node/'.$task3->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$task3->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    $this->assertNoLink($taskAssigned->title, 'The Task appears not on the list');
+    $this->assertNoRaw('node/'.$taskAssigned->nid.'/edit', 'The Task edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$taskAssigned->nid.'/delete', 'The Task delete icon appears not on the list');
+
+    $this->assertLink($taskAssignedTeam->title, 0, 'The Task appears on the list');
+    $this->assertRaw('node/'.$taskAssignedTeam->nid.'/edit', 'The Task edit icon appears on the list');
+    $this->assertRaw('node/'.$taskAssignedTeam->nid.'/delete', 'The Task delete icon appears on the list');
+  }
 }
diff --git a/stormteam/stormteam.module b/stormteam/stormteam.module
index b13c70e..15e9102 100644
--- a/stormteam/stormteam.module
+++ b/stormteam/stormteam.module
@@ -514,7 +514,9 @@ function stormteam_list() {
     ),
   );
 
-  $s = "SELECT DISTINCT(n.nid), n.title, n.type, nre.teaser FROM {node} AS n INNER JOIN {stormteam} as ste ON n.vid=ste.vid INNER JOIN {node_revisions} as nre ON n.vid = nre.vid
+  $s = "SELECT n.nid, n.title, n.type, nre.teaser, nre.format, n.uid FROM {node} AS n
+    INNER JOIN {node_revisions} AS nre ON n.vid = nre.vid
+    LEFT JOIN {stormteam} AS ste ON n.vid = ste.vid
     WHERE n.status=1 AND n.type='stormteam'";
 
   $where = array();
@@ -527,11 +529,7 @@ function stormteam_list() {
     $filterfields[] = t('Team name');
   }
 
-  $itemsperpage = $_SESSION['stormteam_list_filter']['itemsperpage'];
-  if (!isset($itemsperpage)) {
-    // Sets value for fieldset label, does not affect filter itself.
-    $itemsperpage = variable_get('storm_default_items_per_page', 10);
-  }
+  $itemsperpage = isset($_SESSION['stormteam_list_filter']['itemsperpage']) ? $_SESSION['stormteam_list_filter']['itemsperpage'] : variable_get('storm_default_items_per_page', 10);
 
   if (count($filterfields) == 0) {
     $filterdesc = t('Not filtered');
@@ -571,13 +569,10 @@ function stormteam_list() {
  * Function to define form for setting Storm Team list filter.
  */
 function stormteam_list_filter(&$form_state, $filterdesc = 'Filter') {
-  $name = $_SESSION['stormteam_list_filter']['name'];
+  $name = isset($_SESSION['stormteam_list_filter']['name']) ? $_SESSION['stormteam_list_filter']['name'] : '';
 
-  $itemsperpage = $_SESSION['stormteam_list_filter']['itemsperpage'];
-  if (!isset($itemsperpage)) {
-    $itemsperpage = variable_get('storm_default_items_per_page', 10);
-    $_SESSION['stormteam_list_filter']['itemsperpage'] = $itemsperpage;
-  }
+  $itemsperpage = isset($_SESSION['stormteam_list_filter']['itemsperpage']) ? $_SESSION['stormteam_list_filter']['itemsperpage'] : variable_get('storm_default_items_per_page', 10);
+  $_SESSION['stormteam_list_filter']['itemsperpage'] = $itemsperpage;
 
   $form = array();
 
diff --git a/stormteam/stormteam.test b/stormteam/stormteam.test
index 56aac54..6b207d3 100644
--- a/stormteam/stormteam.test
+++ b/stormteam/stormteam.test
@@ -31,4 +31,127 @@ class StormteamTestCase extends DrupalWebTestCase {
 
     $this->assertText(t('Team @title has been created.', array('@title' => $team['title'])));;
   }
+
+  public function testStormteamList() {
+    // Create and login user
+    $userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm team: access', 'Storm team: add', 'Storm team: view all', 'Storm team: edit all', 'Storm team: delete all', 'Storm person: add', 'Storm person: view all'));
+    $userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm team: access', 'Storm team: add', 'Storm team: view belonged', 'Storm team: edit belonged', 'Storm team: delete belonged'));
+    $userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm team: access', 'Storm team: add', 'Storm team: view own', 'Storm team: edit own', 'Storm team: delete own'));
+    $userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm team: access', 'Storm team: add', 'Storm team: view all', 'Storm team: edit own', 'Storm team: delete own'));
+
+    $this->drupalLogin($userAll);
+
+    // Create organization
+    $org = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org, t('Save'));
+    $org = node_load(array('title' => $org['title']));
+
+    // Create organization
+    $org2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org2, t('Save'));
+    $org2 = node_load(array('title' => $org2['title']));
+
+    // Create stormperson with organization to userOrg
+    $person = array(
+      'title' => $this->randomName(32),
+      'organization_nid' => $org->nid,
+      'user_name' => $userOrg->name,
+    );
+    $this->drupalPost('node/add/stormperson', $person, t('Save'));
+    $person = node_load(array('title' => $person['title']));
+
+    // Create teams
+    $team1 = array(
+      'title' => $this->randomName(32),
+      'members_array_1' => $person->nid,
+    );
+    $this->drupalPost('node/add/stormteam', $team1, t('Save'));
+    $team1 = node_load(array('title' => $team1['title']));
+
+    $this->drupalLogin($userOwn);
+    $team2 = array(
+      'title' => $this->randomName(32),
+    );
+    $this->drupalPost('node/add/stormteam', $team2, t('Save'));
+    $team2 = node_load(array('title' => $team2['title']));
+
+    $this->drupalLogin($userViewAllEditOwn);
+    $team3 = array(
+      'title' => $this->randomName(32),
+    );
+    $this->drupalPost('node/add/stormteam', $team3, t('Save'));
+    $team3 = node_load(array('title' => $team3['title']));
+
+    // Test for 'Storm team: view all'
+    $this->drupalLogin($userAll);
+    $this->drupalGet('storm/teams');
+
+    $this->assertLink($team1->title, 0, 'The Team appears on the list');
+    $this->assertRaw('node/'.$team1->nid.'/edit', 'The Team edit icon appears on the list');
+    $this->assertRaw('node/'.$team1->nid.'/delete', 'The Team delete icon appears on the list');
+
+    $this->assertLink($team2->title, 0, 'The Team appears on the list');
+    $this->assertRaw('node/'.$team2->nid.'/edit', 'The Team edit icon appears on the list');
+    $this->assertRaw('node/'.$team2->nid.'/delete', 'The Team delete icon appears on the list');
+
+    $this->assertLink($team3->title, 0, 'The Team appears on the list');
+    $this->assertRaw('node/'.$team3->nid.'/edit', 'The Team edit icon appears on the list');
+    $this->assertRaw('node/'.$team3->nid.'/delete', 'The Team delete icon appears on the list');
+
+    // Test for 'Storm team: view belonged'
+    $this->drupalLogin($userOrg);
+    $this->drupalGet('storm/teams');
+
+    $this->assertLink($team1->title, 0, 'The Team appears on the list');
+    $this->assertRaw('node/'.$team1->nid.'/edit', 'The Team edit icon appears on the list');
+    $this->assertRaw('node/'.$team1->nid.'/delete', 'The Team delete icon appears on the list');
+
+    $this->assertNoLink($team2->title, 'The Team appears not on the list');
+    $this->assertNoRaw('node/'.$team2->nid.'/edit', 'The Team edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$team2->nid.'/delete', 'The Team delete icon appears not on the list');
+
+    $this->assertNoLink($team3->title, 'The Team appears not on the list');
+    $this->assertNoRaw('node/'.$team3->nid.'/edit', 'The Team edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$team3->nid.'/delete', 'The Team delete icon appears not on the list');
+
+    // Test for 'Storm team: view own'
+    $this->drupalLogin($userOwn);
+    $this->drupalGet('storm/teams');
+
+    $this->assertNoLink($team1->title, 'The Team appears not on the list');
+    $this->assertNoRaw('node/'.$team1->nid.'/edit', 'The Team edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$team1->nid.'/delete', 'The Team delete icon appears not on the list');
+
+    $this->assertLink($team2->title, 0, 'The Team appears on the list');
+    $this->assertRaw('node/'.$team2->nid.'/edit', 'The Team edit icon appears on the list');
+    $this->assertRaw('node/'.$team2->nid.'/delete', 'The Team delete icon appears on the list');
+
+    $this->assertNoLink($team3->title, 'The Team appears not on the list');
+    $this->assertNoRaw('node/'.$team3->nid.'/edit', 'The Team edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$team3->nid.'/delete', 'The Team delete icon appears not on the list');
+
+
+    // Test for 'Storm team: view all', 'Storm team: edit own'
+    $this->drupalLogin($userViewAllEditOwn);
+    $this->drupalGet('storm/teams');
+
+    $this->assertLink($team1->title, 0, 'The Team appears on the list');
+    $this->assertNoRaw('node/'.$team1->nid.'/edit', 'The Team edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$team1->nid.'/delete', 'The Team edit icon does not appear on the list');
+
+    $this->assertLink($team2->title, 0, 'The Team appears on the list');
+    $this->assertNoRaw('node/'.$team2->nid.'/edit', 'The Team edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$team2->nid.'/delete', 'The Team delete icon appears not on the list');
+
+    $this->assertLink($team3->title, 0, 'The Team appears on the list');
+    $this->assertRaw('node/'.$team3->nid.'/edit', 'The Team edit icon appears on the list');
+    $this->assertRaw('node/'.$team3->nid.'/delete', 'The Team delete icon appears on the list');
+
+  }
 }
diff --git a/stormticket/stormticket.admin.inc b/stormticket/stormticket.admin.inc
index 01fac07..e41ea68 100644
--- a/stormticket/stormticket.admin.inc
+++ b/stormticket/stormticket.admin.inc
@@ -82,7 +82,10 @@ function stormticket_list() {
   $args = array();
   $filterfields = array();
 
-  $s = "SELECT n.*, sti.* FROM  {node} AS n INNER JOIN {stormticket} AS sti ON n.vid=sti.vid WHERE n.status=1 AND n.type='stormticket' ";
+  $s = "SELECT n.*, sti.*, nre.format FROM  {node} AS n
+    INNER JOIN {stormticket} AS sti ON n.vid=sti.vid
+    INNER JOIN {node_revisions} AS nre ON n.vid = nre.vid
+    WHERE n.status=1 AND n.type='stormticket' ";
 
   if (isset($_SESSION['stormticket_list_filter']['organization_nid']) && ($_SESSION['stormticket_list_filter']['organization_nid'] != 0)) {
     $where[] = 'sti.organization_nid=%d';
diff --git a/stormticket/stormticket.module b/stormticket/stormticket.module
index d8c02de..5b76a04 100644
--- a/stormticket/stormticket.module
+++ b/stormticket/stormticket.module
@@ -76,13 +76,13 @@ function stormticket_access($op, $node, $account=NULL) {
     elseif (user_access('Storm ticket: delete of user organization') && ($account->stormorganization_nid == $node->organization_nid)) {
       return TRUE;
     }
-    elseif (user_access('Storm ticket: delete if assigned to ticket' && ($account->stormperson_nid == $node->assigned_nid))) {
+    elseif (user_access('Storm ticket: delete if assigned to ticket') && ($account->stormperson_nid == $node->assigned_nid)) {
       return TRUE;
     }
-    elseif (user_access('Storm ticket: delete if assigned to ticket' && module_exists('stormteam') && stormteam_user_belongs_to_team($node->assigned_nid, $account->stormperson_nid))) {
+    elseif (user_access('Storm ticket: delete if assigned to ticket') && module_exists('stormteam') && stormteam_user_belongs_to_team($node->assigned_nid, $account->stormperson_nid)) {
       return TRUE;
     }
-    elseif (user_access('Storm ticket: delete if assigned to ticket' && module_exists('stormteam') && stormteam_user_belongs_to_team($node->assigned_nid, $account->stormorganization_nid))) {
+    elseif (user_access('Storm ticket: delete if assigned to ticket') && module_exists('stormteam') && stormteam_user_belongs_to_team($node->assigned_nid, $account->stormorganization_nid)) {
       return TRUE;
     }
   }
@@ -153,7 +153,7 @@ function stormticket_access_sql($sql, $where=array()) {
 
     if (module_exists('stormteam')) {
       // Load teams that the account belongs to
-      $belonged_teams = stormteam_user_return_teams($account);
+      $belonged_teams = stormteam_user_return_teams();
       // Allow access if any of those teams is the one in question
       foreach ($belonged_teams as $belonged_team) {
         $cond .= ' OR sti.assigned_nid = '. $belonged_team;
@@ -333,10 +333,10 @@ function stormticket_form(&$node) {
   if (arg(1)=='add') {
     $node->datebegin = time();
 
-    if (array_key_exists('organization_nid', $_GET) && !$node->organization_nid) {
+    if (array_key_exists('organization_nid', $_GET) && empty($node->organization_nid)) {
       $node->organization_nid = $_GET['organization_nid'];
     }
-    if (array_key_exists('project_nid', $_GET) && !$node->project_nid) {
+    if (array_key_exists('project_nid', $_GET) && empty($node->project_nid)) {
       $node->project_nid = $_GET['project_nid'];
       $p = node_load($node->project_nid);
       $node->organization_nid = $p->organization_nid;
@@ -345,7 +345,7 @@ function stormticket_form(&$node) {
         drupal_goto('node/'. $node->project_nid);
       }
     }
-    if (array_key_exists('task_nid', $_GET) && !$node->task_nid) {
+    if (array_key_exists('task_nid', $_GET) && empty($node->task_nid)) {
       $node->task_nid = $_GET['task_nid'];
       $t = node_load($node->task_nid);
       $node->organization_nid = $t->organization_nid;
diff --git a/stormticket/stormticket.test b/stormticket/stormticket.test
index 17d35c4..dee659b 100644
--- a/stormticket/stormticket.test
+++ b/stormticket/stormticket.test
@@ -14,7 +14,7 @@ class StormticketTestCase extends DrupalWebTestCase {
   }
 
   public function setUp() {
-    parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormticket');
+    parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormticket', 'stormperson', 'stormteam');
   }
 
   public function testStormticketAccess() {
@@ -61,4 +61,284 @@ class StormticketTestCase extends DrupalWebTestCase {
 
     $this->assertText(t('Ticket @title has been created.', array('@title' => $ticket['title'])));;
   }
+
+  public function testStormticketList() {
+    // Create and login user
+    $userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view all', 'Storm ticket: edit all', 'Storm ticket: delete all', 'Storm person: add', 'Storm team: add', 'Storm person: view all', 'Storm team: view all', 'Storm project: add', 'Storm project: view all'));
+    $userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view of user organization', 'Storm ticket: edit of user organization', 'Storm ticket: delete of user organization'));
+    $userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view own', 'Storm ticket: edit own', 'Storm ticket: delete own', 'Storm project: view all'));
+    $userAssigned = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view if assigned to ticket', 'Storm ticket: edit if assigned to ticket', 'Storm ticket: delete if assigned to ticket'));
+    $userAssignedTeam = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view if assigned to ticket', 'Storm ticket: edit if assigned to ticket', 'Storm ticket: delete if assigned to ticket'));
+    $userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view all', 'Storm ticket: edit own', 'Storm ticket: delete own', 'Storm project: view all'));
+
+    $this->drupalLogin($userAll);
+
+    // Create organization
+    $org = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org, t('Save'));
+    $org = node_load(array('title' => $org['title']));
+
+    // Create organization
+    $org2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org2, t('Save'));
+    $org2 = node_load(array('title' => $org2['title']));
+
+    // Create stormperson with organization to userOrg
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userOrg->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userAssigned->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+    $assignedPerson = node_load(array('title' => $personOrg['title']));
+
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userAssignedTeam->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+    $assignedPersonTeam = node_load(array('title' => $personOrg['title']));
+
+    $team = array(
+      'title' => $this->randomName(32),
+      'members_array_1' => $assignedPersonTeam->nid,
+    );
+    $this->drupalPost('node/add/stormteam', $team, t('Save'));
+    $team = node_load(array('title' => $team['title']));
+
+    // Create project foreach organization
+    $prj = array(
+      'title' => $this->randomName(32),
+      'organization_nid' => $org->nid,
+    );
+    $this->drupalPost('node/add/stormproject', $prj, t('Save'));
+    $projectOrg = node_load(array('title' => $prj['title']));
+
+    $prj = array(
+      'title' => $this->randomName(32),
+      'organization_nid' => $org->nid,
+      'assigned_nid' => $team->nid,
+    );
+    $this->drupalPost('node/add/stormproject', $prj, t('Save'));
+    $projectTeam = node_load(array('title' => $prj['title']));
+
+    $prj = array(
+      'title' => $this->randomName(32),
+      'organization_nid' => $org2->nid,
+      'assigned_nid' => $team->nid,
+    );
+    $this->drupalPost('node/add/stormproject', $prj, t('Save'));
+    $projectOrg2 = node_load(array('title' => $prj['title']));
+
+    // Create tickets
+    $ticket1 = array(
+      'organization_nid' => $org->nid,
+      'project_nid' => $projectOrg->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormticket', $ticket1, t('Save'), array('query' => 'organization_nid='.$org->nid));
+    $ticket1 = node_load(array('title' => $ticket1['title']));
+
+    $ticketAssigned = array(
+      'organization_nid' => $org->nid,
+      'project_nid' => $projectOrg->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'assigned_nid' => $assignedPerson->nid,
+    );
+    $this->drupalPost('node/add/stormticket', $ticketAssigned, t('Save'), array('query' => 'organization_nid='.$org->nid.'&project_nid='.$projectOrg->nid));
+    $ticketAssigned = node_load(array('title' => $ticketAssigned['title']));
+
+    $ticketAssignedTeam = array(
+      'organization_nid' => $org->nid,
+      'project_nid' => $projectTeam->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'assigned_nid' => $team->nid,
+    );
+    $this->drupalPost('node/add/stormticket', $ticketAssignedTeam, t('Save'), array('query' => 'organization_nid='.$org->nid.'&project_nid='.$projectTeam->nid));
+    $ticketAssignedTeam = node_load(array('title' => $ticketAssignedTeam['title']));
+
+    $this->drupalLogin($userOwn);
+    $ticket2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'project_nid' => $projectOrg->nid,
+    );
+    $this->drupalPost('node/add/stormticket', $ticket2, t('Save'), array('query' => 'organization_nid='.$org->nid));
+    $ticket2 = node_load(array('title' => $ticket2['title']));
+
+    $this->drupalLogin($userViewAllEditOwn);
+    $ticket3 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org2->nid,
+      'project_nid' => $projectOrg2->nid,
+    );
+    $this->drupalPost('node/add/stormticket', $ticket3, t('Save'), array('query' => 'organization_nid='.$org2->nid));
+    $ticket3 = node_load(array('title' => $ticket3['title']));
+
+    // Test for 'Storm ticket: view all'
+    $this->drupalLogin($userAll);
+    $this->drupalGet('storm/tickets');
+
+    $this->assertLink($ticket1->title, 0, 'The Ticket appears on the list');
+    $this->assertRaw('node/'.$ticket1->nid.'/edit', 'The Ticket edit icon appears on the list');
+    $this->assertRaw('node/'.$ticket1->nid.'/delete', 'The Ticket delete icon appears on the list');
+
+    $this->assertLink($ticket2->title, 0, 'The Ticket appears on the list');
+    $this->assertRaw('node/'.$ticket2->nid.'/edit', 'The Ticket edit icon appears on the list');
+    $this->assertRaw('node/'.$ticket2->nid.'/delete', 'The Ticket delete icon appears on the list');
+
+    $this->assertLink($ticket3->title, 0, 'The Ticket appears on the list');
+    $this->assertRaw('node/'.$ticket3->nid.'/edit', 'The Ticket edit icon appears on the list');
+    $this->assertRaw('node/'.$ticket3->nid.'/delete', 'The Ticket delete icon appears on the list');
+
+    $this->assertLink($ticketAssigned->title, 0, 'The Ticket appears on the list');
+    $this->assertRaw('node/'.$ticketAssigned->nid.'/edit', 'The Ticket edit icon appears on the list');
+    $this->assertRaw('node/'.$ticketAssigned->nid.'/delete', 'The Ticket delete icon appears on the list');
+
+    $this->assertLink($ticketAssignedTeam->title, 0, 'The Ticket appears on the list');
+    $this->assertRaw('node/'.$ticketAssignedTeam->nid.'/edit', 'The Ticket edit icon appears on the list');
+    $this->assertRaw('node/'.$ticketAssignedTeam->nid.'/delete', 'The Ticket delete icon appears on the list');
+
+    // Test for 'Storm ticket: view of user organization'
+    $this->drupalLogin($userOrg);
+    $this->drupalGet('storm/tickets');
+
+    $this->assertLink($ticket1->title, 0, 'The Ticket appears on the list');
+    $this->assertRaw('node/'.$ticket1->nid.'/edit', 'The Ticket edit icon appears on the list');
+    $this->assertRaw('node/'.$ticket1->nid.'/delete', 'The Ticket delete icon appears on the list');
+
+    $this->assertLink($ticket2->title, 0, 'The Ticket appears on the list');
+    $this->assertRaw('node/'.$ticket2->nid.'/edit', 'The Ticket edit icon appears on the list');
+    $this->assertRaw('node/'.$ticket2->nid.'/delete', 'The Ticket delete icon appears on the list');
+
+    $this->assertNoLink($ticket3->title, 'The Ticket appears not on the list');
+    $this->assertNoRaw('node/'.$ticket3->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticket3->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    $this->assertLink($ticketAssigned->title, 0, 'The Ticket appears on the list');
+    $this->assertRaw('node/'.$ticketAssigned->nid.'/edit', 'The Ticket edit icon appears on the list');
+    $this->assertRaw('node/'.$ticketAssigned->nid.'/delete', 'The Ticket delete icon appears on the list');
+
+    $this->assertLink($ticketAssignedTeam->title, 0, 'The Ticket appears on the list');
+    $this->assertRaw('node/'.$ticketAssignedTeam->nid.'/edit', 'The Ticket edit icon appears on the list');
+    $this->assertRaw('node/'.$ticketAssignedTeam->nid.'/delete', 'The Ticket delete icon appears on the list');
+
+    // Test for 'Storm ticket: view own'
+    $this->drupalLogin($userOwn);
+    $this->drupalGet('storm/tickets');
+
+    $this->assertNoLink($ticket1->title, 'The Ticket appears not on the list');
+    $this->assertNoRaw('node/'.$ticket1->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticket1->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    $this->assertLink($ticket2->title, 0, 'The Ticket appears on the list');
+    $this->assertRaw('node/'.$ticket2->nid.'/edit', 'The Ticket edit icon appears on the list');
+    $this->assertRaw('node/'.$ticket2->nid.'/delete', 'The Ticket delete icon appears on the list');
+
+    $this->assertNoLink($ticket3->title, 'The Ticket appears not on the list');
+    $this->assertNoRaw('node/'.$ticket3->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticket3->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    $this->assertNoLink($ticketAssigned->title, 'The Ticket appears not on the list');
+    $this->assertNoRaw('node/'.$ticketAssigned->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticketAssigned->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    $this->assertNoLink($ticketAssignedTeam->title, 'The Ticket appears not on the list');
+    $this->assertNoRaw('node/'.$ticketAssignedTeam->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticketAssignedTeam->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    // Test for 'Storm ticket: view all', 'Storm ticket: edit own'
+    $this->drupalLogin($userViewAllEditOwn);
+    $this->drupalGet('storm/tickets');
+
+    $this->assertLink($ticket1->title, 0, 'The Ticket appears on the list');
+    $this->assertNoRaw('node/'.$ticket1->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticket1->nid.'/delete', 'The Ticket edit icon does not appear on the list');
+
+    $this->assertLink($ticket2->title, 0, 'The Ticket appears on the list');
+    $this->assertNoRaw('node/'.$ticket2->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticket2->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    $this->assertLink($ticket3->title, 0, 'The Ticket appears on the list');
+    $this->assertRaw('node/'.$ticket3->nid.'/edit', 'The Ticket edit icon appears on the list');
+    $this->assertRaw('node/'.$ticket3->nid.'/delete', 'The Ticket delete icon appears on the list');
+
+    $this->assertLink($ticketAssigned->title, 0, 'The Ticket appears on the list');
+    $this->assertNoRaw('node/'.$ticketAssigned->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticketAssigned->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    $this->assertLink($ticketAssignedTeam->title, 0, 'The Ticket appears on the list');
+    $this->assertNoRaw('node/'.$ticketAssignedTeam->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticketAssignedTeam->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    // Test for 'Storm ticket: view if assigned to ticket'
+    $this->drupalLogin($userAssigned);
+    $this->drupalGet('storm/tickets');
+
+    $this->assertNoLink($ticket1->title, 'The Ticket appears not on the list');
+    $this->assertNoRaw('node/'.$ticket1->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticket1->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    $this->assertNoLink($ticket2->title, 'The Ticket appears not on the list');
+    $this->assertNoRaw('node/'.$ticket2->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticket2->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    $this->assertNoLink($ticket3->title, 'The Ticket appears not on the list');
+    $this->assertNoRaw('node/'.$ticket3->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticket3->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    $this->assertLink($ticketAssigned->title, 0, 'The Ticket appears on the list');
+    $this->assertRaw('node/'.$ticketAssigned->nid.'/edit', 'The Ticket edit icon appears on the list');
+    $this->assertRaw('node/'.$ticketAssigned->nid.'/delete', 'The Ticket delete icon appears on the list');
+
+    $this->assertNoLink($ticketAssignedTeam->title, 'The Ticket appears not on the list');
+    $this->assertNoRaw('node/'.$ticketAssignedTeam->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticketAssignedTeam->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    // Test for 'Storm ticket: view if assigned to ticket' (using team)
+    $this->drupalLogin($userAssignedTeam);
+    $this->drupalGet('storm/tickets');
+
+    $this->assertNoLink($ticket1->title, 'The Ticket appears not on the list');
+    $this->assertNoRaw('node/'.$ticket1->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticket1->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    $this->assertNoLink($ticket2->title, 'The Ticket appears not on the list');
+    $this->assertNoRaw('node/'.$ticket2->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticket2->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    $this->assertNoLink($ticket3->title, 'The Ticket appears not on the list');
+    $this->assertNoRaw('node/'.$ticket3->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticket3->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    $this->assertNoLink($ticketAssigned->title, 'The Ticket appears not on the list');
+    $this->assertNoRaw('node/'.$ticketAssigned->nid.'/edit', 'The Ticket edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$ticketAssigned->nid.'/delete', 'The Ticket delete icon appears not on the list');
+
+    $this->assertLink($ticketAssignedTeam->title, 0, 'The Ticket appears on the list');
+    $this->assertRaw('node/'.$ticketAssignedTeam->nid.'/edit', 'The Ticket edit icon appears on the list');
+    $this->assertRaw('node/'.$ticketAssignedTeam->nid.'/delete', 'The Ticket delete icon appears on the list');
+  }
 }
diff --git a/stormticket/stormticket.theme.inc b/stormticket/stormticket.theme.inc
index 675eafb..e20b858 100644
--- a/stormticket/stormticket.theme.inc
+++ b/stormticket/stormticket.theme.inc
@@ -8,12 +8,6 @@ function theme_stormticket_list($header, $tickets) {
 
   $rows = array();
   foreach ($tickets as $ticket) {
-    $n = new stdClass();
-    $n->nid = $ticket->nid;
-    $n->uid = $ticket->uid;
-    $n->organization_nid = $ticket->organization_nid;
-    $n->type = 'stormticket';
-
     $rows[] = array(
       storm_icon('category_'. $ticket->ticketcategory, storm_attribute_value('Ticket category', $ticket->ticketcategory)),
       l($ticket->organization_title, 'node/'. $ticket->organization_nid),
@@ -23,7 +17,7 @@ function theme_stormticket_list($header, $tickets) {
       storm_icon('status_'. $ticket->ticketstatus, storm_attribute_value('Ticket status', $ticket->ticketstatus)),
       storm_icon('priority_'. $ticket->ticketpriority, storm_attribute_value('Ticket priority', $ticket->ticketpriority)),
       array(
-        'data' => storm_icon_edit_node($n, $_GET) .'&nbsp;'. storm_icon_delete_node($n, $_GET),
+        'data' => storm_icon_edit_node($ticket, $_GET) .'&nbsp;'. storm_icon_delete_node($ticket, $_GET),
         'class' => 'storm_list_operations',
       ),
     );
diff --git a/stormtimetracking/stormtimetracking.admin.inc b/stormtimetracking/stormtimetracking.admin.inc
index be46306..61dcae5 100644
--- a/stormtimetracking/stormtimetracking.admin.inc
+++ b/stormtimetracking/stormtimetracking.admin.inc
@@ -86,8 +86,10 @@ function stormtimetracking_list() {
     ),
   );
 
-  $s = "SELECT n.*,  stt.* FROM {node} n INNER JOIN {stormtimetracking} stt ON n.vid=stt.vid
-  WHERE n.status=1 AND n.type='stormtimetracking' ";
+  $s = "SELECT n.*,  stt.*, nre.format FROM {node} n
+    INNER JOIN {stormtimetracking} stt ON n.vid=stt.vid
+    INNER JOIN {node_revisions} AS nre ON n.vid = nre.vid
+    WHERE n.status=1 AND n.type='stormtimetracking' ";
 
   $s_duration = "SELECT SUM(billing_duration) FROM {stormtimetracking} stt INNER JOIN {node} n ON n.vid=stt.vid WHERE n.status=1 AND n.type='stormtimetracking' ";
 
@@ -142,11 +144,7 @@ function stormtimetracking_list() {
     $filterfields[] = t('Billed');
   }
 
-  $itemsperpage = $_SESSION['stormtimetracking_list_filter']['itemsperpage'];
-  if (!isset($itemsperpage)) {
-    $itemsperpage = variable_get('storm_default_items_per_page', 10);
-    $_SESSION['stormtimetracking_list_filter']['itemsperpage'] =  $itemsperpage;
-  }
+  $itemsperpage = isset($_SESSION['stormtimetracking_list_filter']['itemsperpage']) ? $_SESSION['stormtimetracking_list_filter']['itemsperpage'] : variable_get('storm_default_items_per_page', 10);
 
   if (isset($_SESSION['stormtimetracking_list_filter']['user']) && $_SESSION['stormtimetracking_list_filter']['user'] != '') {
     $trackinguser = user_load(array('name' => $_SESSION['stormtimetracking_list_filter']['user']));
@@ -162,7 +160,7 @@ function stormtimetracking_list() {
   else {
     $filterdesc = t('Filtered by !fields', array('!fields' => implode(", ", array_unique($filterfields))));
   }
-  $filterdesc .= ' | '. t('!items items per page', array('!items' => $_SESSION['stormtimetracking_list_filter']['itemsperpage']));
+  $filterdesc .= ' | '. t('!items items per page', array('!items' => $itemsperpage));
 
   $o = drupal_get_form('stormtimetracking_list_filter', $filterdesc);
 
@@ -191,20 +189,18 @@ function stormtimetracking_list() {
 }
 
 function stormtimetracking_list_filter(&$form_state, $filterdesc = 'Filter') {
-  $organization_nid = $_SESSION['stormtimetracking_list_filter']['organization_nid'];
-  $project_nid = $_SESSION['stormtimetracking_list_filter']['project_nid'];
-  $task_nid = $_SESSION['stormtimetracking_list_filter']['task_nid'];
-  $ticket_nid = $_SESSION['stormtimetracking_list_filter']['ticket_nid'];
-  $itemsperpage = $_SESSION['stormtimetracking_list_filter']['itemsperpage'];
-  if (!isset($itemsperpage)) {
-    $itemsperpage = variable_get('storm_default_items_per_page', 10);
-    $_SESSION['stormtimetracking_list_filter']['itemsperpage'] = $itemsperpage;
-  }
+  $organization_nid = isset($_SESSION['stormtimetracking_list_filter']['organization_nid']) ? $_SESSION['stormtimetracking_list_filter']['organization_nid'] : 0;
+  $project_nid = isset($_SESSION['stormtimetracking_list_filter']['project_nid']) ? $_SESSION['stormtimetracking_list_filter']['project_nid'] : 0 ;
+  $task_nid = isset($_SESSION['stormtimetracking_list_filter']['task_nid']) ? $_SESSION['stormtimetracking_list_filter']['task_nid'] : 0;
+  $ticket_nid = isset($_SESSION['stormtimetracking_list_filter']['ticket_nid']) ? $_SESSION['stormtimetracking_list_filter']['ticket_nid'] : 0;
+  $itemsperpage = isset($_SESSION['stormtimetracking_list_filter']['itemsperpage']) ? $_SESSION['stormtimetracking_list_filter']['itemsperpage'] : variable_get('storm_default_items_per_page', 10);
 
   $datefrom = isset($_SESSION['stormtimetracking_list_filter']['datefrom']) ? $_SESSION['stormtimetracking_list_filter']['datefrom'] : NULL;
   $dateto = isset($_SESSION['stormtimetracking_list_filter']['dateto']) ? $_SESSION['stormtimetracking_list_filter']['dateto'] : NULL ;
 
-  $trackinguser = $_SESSION['stormtimetracking_list_filter']['user'];
+  $trackinguser = isset($_SESSION['stormtimetracking_list_filter']['user']) ? $_SESSION['stormtimetracking_list_filter']['user'] : '';
+  $billable = isset($_SESSION['stormtimetracking_list_filter']['billable']) ? $_SESSION['stormtimetracking_list_filter']['billable'] : '-';
+  $billed = isset($_SESSION['stormtimetracking_list_filter']['billed']) ? $_SESSION['stormtimetracking_list_filter']['billed'] : '-';
 
   $form = array();
 
@@ -326,14 +322,14 @@ function stormtimetracking_list_filter(&$form_state, $filterdesc = 'Filter') {
     '#type' => 'select',
     '#title' => 'Billable',
     '#options' => array('-' => t('all'), '1' => t('billable'), '0' => t('not billable')),
-    '#default_value' => $_SESSION['stormtimetracking_list_filter']['billable'],
+    '#default_value' => $billable,
   );
 
   $form['filter']['group3']['billed'] = array(
     '#type' => 'select',
     '#title' => 'Billed',
     '#options' => array('-' => t('all'), '1' => t('billed'), '0' => t('not billed')),
-    '#default_value' => $_SESSION['stormtimetracking_list_filter']['billed'],
+    '#default_value' => $billed,
   );
 
   $form['filter']['group4'] = array(
diff --git a/stormtimetracking/stormtimetracking.test b/stormtimetracking/stormtimetracking.test
index f4378b4..d6ee378 100644
--- a/stormtimetracking/stormtimetracking.test
+++ b/stormtimetracking/stormtimetracking.test
@@ -14,7 +14,7 @@ class StormtimetrackingTestCase extends DrupalWebTestCase {
   }
 
   public function setUp() {
-    parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormticket', 'stormtimetracking');
+    parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormticket', 'stormtimetracking', 'stormperson');
   }
 
   public function testStormtimetrackingCreate() {
@@ -51,4 +51,132 @@ class StormtimetrackingTestCase extends DrupalWebTestCase {
 
     $this->assertText(t('Timetracking @title has been created.', array('@title' => $timetracking['title'])));;
   }
+
+  public function testStormtimetrackingList() {
+    // Create and login user
+    $userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm timetracking: access', 'Storm timetracking: add', 'Storm timetracking: view all', 'Storm timetracking: edit all', 'Storm timetracking: delete all', 'Storm person: add'));
+    $userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm timetracking: access', 'Storm timetracking: add', 'Storm timetracking: view of user organization', 'Storm timetracking: edit of user organization', 'Storm timetracking: delete of user organization'));
+    $userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm timetracking: access', 'Storm timetracking: add', 'Storm timetracking: view own', 'Storm timetracking: edit own', 'Storm timetracking: delete own'));
+    $userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm timetracking: access', 'Storm timetracking: add', 'Storm timetracking: view all', 'Storm timetracking: edit own', 'Storm timetracking: delete own'));
+
+    $this->drupalLogin($userAll);
+
+    // Create organization
+    $org = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org, t('Save'));
+    $org = node_load(array('title' => $org['title']));
+
+    // Create organization
+    $org2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormorganization', $org2, t('Save'));
+    $org2 = node_load(array('title' => $org2['title']));
+
+    // Create stormperson with organization to userOrg
+    $personOrg = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+      'user_name' => $userOrg->name,
+    );
+    $this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
+
+    // Create timetrackings
+    $timetracking1 = array(
+      'organization_nid' => $org->nid,
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+    );
+    $this->drupalPost('node/add/stormtimetracking', $timetracking1, t('Save'));
+    $timetracking1 = node_load(array('title' => $timetracking1['title']));
+
+    $this->drupalLogin($userOwn);
+    $timetracking2 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org->nid,
+    );
+    $this->drupalPost('node/add/stormtimetracking', $timetracking2, t('Save'));
+    $timetracking2 = node_load(array('title' => $timetracking2['title']));
+
+    $this->drupalLogin($userViewAllEditOwn);
+    $timetracking3 = array(
+      'title' => $this->randomName(32),
+      'body' => $this->randomName(64),
+      'organization_nid' => $org2->nid,
+    );
+    $this->drupalPost('node/add/stormtimetracking', $timetracking3, t('Save'));
+    $timetracking3 = node_load(array('title' => $timetracking3['title']));
+
+    // Test for 'Storm timetracking: view all'
+    $this->drupalLogin($userAll);
+    $this->drupalGet('storm/timetrackings');
+
+    $this->assertLink($timetracking1->title, 0, 'The Timetracking appears on the list');
+    $this->assertRaw('node/'.$timetracking1->nid.'/edit', 'The Timetracking edit icon appears on the list');
+    $this->assertRaw('node/'.$timetracking1->nid.'/delete', 'The Timetracking delete icon appears on the list');
+
+    $this->assertLink($timetracking2->title, 0, 'The Timetracking appears on the list');
+    $this->assertRaw('node/'.$timetracking2->nid.'/edit', 'The Timetracking edit icon appears on the list');
+    $this->assertRaw('node/'.$timetracking2->nid.'/delete', 'The Timetracking delete icon appears on the list');
+
+    $this->assertLink($timetracking3->title, 0, 'The Timetracking appears on the list');
+    $this->assertRaw('node/'.$timetracking3->nid.'/edit', 'The Timetracking edit icon appears on the list');
+    $this->assertRaw('node/'.$timetracking3->nid.'/delete', 'The Timetracking delete icon appears on the list');
+
+    // Test for 'Storm timetracking: view of user organization'
+    $this->drupalLogin($userOrg);
+    $this->drupalGet('storm/timetrackings');
+
+    $this->assertLink($timetracking1->title, 0, 'The Timetracking appears on the list');
+    $this->assertRaw('node/'.$timetracking1->nid.'/edit', 'The Timetracking edit icon appears on the list');
+    $this->assertRaw('node/'.$timetracking1->nid.'/delete', 'The Timetracking delete icon appears on the list');
+
+    $this->assertLink($timetracking2->title, 0, 'The Timetracking appears on the list');
+    $this->assertRaw('node/'.$timetracking2->nid.'/edit', 'The Timetracking edit icon appears on the list');
+    $this->assertRaw('node/'.$timetracking2->nid.'/delete', 'The Timetracking delete icon appears on the list');
+
+    $this->assertNoLink($timetracking3->title, 'The Timetracking appears not on the list');
+    $this->assertNoRaw('node/'.$timetracking3->nid.'/edit', 'The Timetracking edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$timetracking3->nid.'/delete', 'The Timetracking delete icon appears not on the list');
+
+    // Test for 'Storm timetracking: view own'
+    $this->drupalLogin($userOwn);
+    $this->drupalGet('storm/timetrackings');
+
+    $this->assertNoLink($timetracking1->title, 'The Timetracking appears not on the list');
+    $this->assertNoRaw('node/'.$timetracking1->nid.'/edit', 'The Timetracking edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$timetracking1->nid.'/delete', 'The Timetracking delete icon appears not on the list');
+
+    $this->assertLink($timetracking2->title, 0, 'The Timetracking appears on the list');
+    $this->assertRaw('node/'.$timetracking2->nid.'/edit', 'The Timetracking edit icon appears on the list');
+    $this->assertRaw('node/'.$timetracking2->nid.'/delete', 'The Timetracking delete icon appears on the list');
+
+    $this->assertNoLink($timetracking3->title, 'The Timetracking appears not on the list');
+    $this->assertNoRaw('node/'.$timetracking3->nid.'/edit', 'The Timetracking edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$timetracking3->nid.'/delete', 'The Timetracking delete icon appears not on the list');
+
+
+    // Test for 'Storm timetracking: view all', 'Storm timetracking: edit own'
+    $this->drupalLogin($userViewAllEditOwn);
+    $this->drupalGet('storm/timetrackings');
+
+    $this->assertLink($timetracking1->title, 0, 'The Timetracking appears on the list');
+    $this->assertNoRaw('node/'.$timetracking1->nid.'/edit', 'The Timetracking edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$timetracking1->nid.'/delete', 'The Timetracking edit icon does not appear on the list');
+
+    $this->assertLink($timetracking2->title, 0, 'The Timetracking appears on the list');
+    $this->assertNoRaw('node/'.$timetracking2->nid.'/edit', 'The Timetracking edit icon does not appear on the list');
+    $this->assertNoRaw('node/'.$timetracking2->nid.'/delete', 'The Timetracking delete icon appears not on the list');
+
+    $this->assertLink($timetracking3->title, 0, 'The Timetracking appears on the list');
+    $this->assertRaw('node/'.$timetracking3->nid.'/edit', 'The Timetracking edit icon appears on the list');
+    $this->assertRaw('node/'.$timetracking3->nid.'/delete', 'The Timetracking delete icon appears on the list');
+
+  }
 }
diff --git a/stormtimetracking/stormtimetracking.theme.inc b/stormtimetracking/stormtimetracking.theme.inc
index e60aa43..c1d3150 100644
--- a/stormtimetracking/stormtimetracking.theme.inc
+++ b/stormtimetracking/stormtimetracking.theme.inc
@@ -7,14 +7,6 @@
 function theme_stormtimetracking_list($header, $timetrackings, $billing_duration) {
   $rows = array();
   foreach ($timetrackings as $timetracking) {
-    $n = new stdClass();
-    $n->nid = $timetracking->nid;
-    $n->uid = $timetracking->uid;
-    $n->organization_nid = $timetracking->organization_nid;
-    $n->project_nid = $timetracking->project_nid;
-    $n->task_nid = $timetracking->task_nid;
-    $n->ticket_nid = $timetracking->ticket_nid;
-    $n->type = 'stormtimetracking';
     $rows[] = array(
       l($timetracking->organization_title, 'node/'. $timetracking->organization_nid),
       l($timetracking->project_title, 'node/'. $timetracking->project_nid),
@@ -22,7 +14,7 @@ function theme_stormtimetracking_list($header, $timetrackings, $billing_duration
       format_date($timetracking->trackingdate, 'small'),
       array('data' => sprintf('%.2f', $timetracking->billing_duration), 'align' => 'right'),
       array(
-        'data' => storm_icon_edit_node($n, $_GET) .'&nbsp;'. storm_icon_delete_node($n, $_GET),
+        'data' => storm_icon_edit_node($timetracking, $_GET) .'&nbsp;'. storm_icon_delete_node($timetracking, $_GET),
         'class' => 'storm_list_operations',
       ),
     );
