diff --git a/modules/monitoring/application/views/scripts/show/components/command.phtml b/modules/monitoring/application/views/scripts/show/components/command.phtml
index 3e30b62e8..6e76bbfc6 100644
--- a/modules/monitoring/application/views/scripts/show/components/command.phtml
+++ b/modules/monitoring/application/views/scripts/show/components/command.phtml
@@ -1,9 +1,12 @@
-<div class="panel panel-default">
+<div>
     <div class="panel-heading">
-        {{CHECK_COMMAND_ICON}}
-        <span>Check Command</span>
+        <div class="panel-hostname">
+            Check Command
+        </div>
     </div>
 
+    <hr class="separator" />
+
     <div class="panel-body">
         <table>
             <tr>
diff --git a/modules/monitoring/application/views/scripts/show/components/contacts.phtml b/modules/monitoring/application/views/scripts/show/components/contacts.phtml
index 3256d3ac6..cbd1a8bb4 100644
--- a/modules/monitoring/application/views/scripts/show/components/contacts.phtml
+++ b/modules/monitoring/application/views/scripts/show/components/contacts.phtml
@@ -1,4 +1,3 @@
-<?php if (!empty($object->contacts)): ?>
 <?php
 $contacts = array();
 foreach ($object->contacts as $contact) {
@@ -14,17 +13,24 @@ foreach ($object->contacts as $contact) {
         . '</a>';
 }
 ?>
-<div class="panel panel-default">
+<div>
     <div class="panel-heading">
-        {{CONTACT_ICON}} <span>Contacts</span>
+        <div class="panel-hostname">
+            Contacts
+        </div>
     </div>
+
+    <hr class="separator" />
+
     <div class="panel-body">
-        <?= implode(', ', $contacts); ?>
+        <?php if (!count($contacts)): ?>
+            No Contacts
+        <?php else: ?>
+            <?= implode(', ', $contacts); ?>
+        <?php endif; ?>
     </div>
 </div>
-<?php endif; ?>
 
-<?php if (!empty($object->contactgroups)): ?>
 <?php
 $contactgroups = array();
 foreach ($object->contactgroups as $contactgroup) {
@@ -40,12 +46,20 @@ foreach ($object->contactgroups as $contactgroup) {
         . '</a>';
 }
 ?>
-<div class="panel panel-default">
+<div>
     <div class="panel-heading">
-        {{CONTACTGROUP_ICON}} <span>Contactgroups</span>
+        <div class="panel-hostname">
+            Contactgroups
+        </div>
     </div>
+
+    <hr class="separator" />
+
     <div class="panel-body">
-        <?= implode(', ', $contactgroups); ?>
+        <?php if (!count($contactgroups)): ?>
+            No Contactgroups
+        <?php else: ?>
+            <?= implode(', ', $contactgroups); ?>
+        <?php endif; ?>
     </div>
 </div>
-<?php endif; ?>
diff --git a/modules/monitoring/application/views/scripts/show/components/customvars.phtml b/modules/monitoring/application/views/scripts/show/components/customvars.phtml
index 093052245..e3ba9563b 100644
--- a/modules/monitoring/application/views/scripts/show/components/customvars.phtml
+++ b/modules/monitoring/application/views/scripts/show/components/customvars.phtml
@@ -8,6 +8,15 @@
     <hr class="separator" />
 
     <div class="panel-body">
-        <?php var_dump($this->object); ?>
+        <?php if (empty($this->object->customvars)): ?>
+        No customvars
+        <?php else: ?>
+        <dl class="dl-horizontal">
+        <?php foreach ($this->object->customvars as $varname => $varvalue): ?>
+            <dt><?= $varname; ?></dt>
+            <dd><?= $varvalue; ?></dd>
+        <?php endforeach; ?>
+        </dl>
+        <?php endif; ?>
     </div>
 </div>
\ No newline at end of file
diff --git a/modules/monitoring/application/views/scripts/show/components/downtime.phtml b/modules/monitoring/application/views/scripts/show/components/downtime.phtml
index 9003e0184..e38b10a14 100644
--- a/modules/monitoring/application/views/scripts/show/components/downtime.phtml
+++ b/modules/monitoring/application/views/scripts/show/components/downtime.phtml
@@ -56,7 +56,7 @@
                 <tr>
                     <td>No Downtimes</td>
                 </tr>
-                <?php endif; ?>
+                <?php else: ?>
                 <?php foreach ($this->object->downtimes as $downtime): ?>
                 <tr>
                     <td>
@@ -89,6 +89,7 @@
                     </td>
                 </tr>
                 <?php endforeach; ?>
+                <?php endif; ?>
             </tbody>
         </table>
     </div>
diff --git a/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml b/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml
index d33ccd590..ffc8c501f 100644
--- a/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml
+++ b/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml
@@ -1,4 +1,3 @@
-<?php if (!empty($object->hostgroups)): ?>
 <?php
 $hostgroups = array();
 foreach ($object->hostgroups as $name => $alias) {
@@ -7,12 +6,20 @@ foreach ($object->hostgroups as $name => $alias) {
         . '</a>';
 }
 ?>
-<div class="panel panel-default">
+<div>
     <div class="panel-heading">
-        {{HOSTGROUP_ICON}} <span>Hostgroups</span>
+        <div class="panel-hostname">
+            Hostgroups
+        </div>
     </div>
+
+    <hr class="separator" />
+
     <div class="panel-body">
-        <?= implode(', ', $hostgroups); ?>
+        <?php if (!count($hostgroups)): ?>
+            No Hostgroups
+        <?php else: ?>
+            <?= implode(', ', $hostgroups); ?>
+        <?php endif; ?>
     </div>
-</div>
-<?php endif; ?>
+</div>
\ No newline at end of file
diff --git a/modules/monitoring/application/views/scripts/show/components/properties.phtml b/modules/monitoring/application/views/scripts/show/components/properties.phtml
index 23e71ac60..161031060 100644
--- a/modules/monitoring/application/views/scripts/show/components/properties.phtml
+++ b/modules/monitoring/application/views/scripts/show/components/properties.phtml
@@ -10,12 +10,8 @@
         <dl class="dl-horizontal">
             <dt>Latency</dt>
             <dd><?= sprintf('%.2f', $this->object->check_execution_time); ?>s</dd>
-        </dl>
-        <dl class="dl-horizontal">
             <dt>Duration</dt>
             <dd><?= sprintf('%.2f', $this->object->check_latency); ?>s</dd>
-        </dl>
-        <dl class="dl-horizontal">
             <dt>Attempt</dt>
             <dd>
                 <?= $this->object->current_check_attempt; ?>/<?= $this->object->max_check_attempts; ?>
diff --git a/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml b/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml
index d2fdbceaf..5f79db497 100644
--- a/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml
+++ b/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml
@@ -1,4 +1,3 @@
-<?php if (!empty($object->servicegroups)): ?>
 <?php
 $servicegroups = array();
 foreach ($object->servicegroups as $name => $alias) {
@@ -7,12 +6,20 @@ foreach ($object->servicegroups as $name => $alias) {
         . '</a>';
 }
 ?>
-<div class="panel panel-default">
+<div>
     <div class="panel-heading">
-        {{SERVICEGROUP_ICON}} <span>Servicegroups</span>
+        <div class="panel-hostname">
+            Servicegroups
+        </div>
     </div>
+
+    <hr class="separator" />
+
     <div class="panel-body">
-        <?= implode(', ', $servicegroups); ?>
+        <?php if (!count($servicegroups)): ?>
+            No Servicegroups
+        <?php else: ?>
+            <?= implode(', ', $servicegroups); ?>
+        <?php endif; ?>
     </div>
 </div>
-<?php endif; ?>
diff --git a/modules/monitoring/application/views/scripts/show/host.phtml b/modules/monitoring/application/views/scripts/show/host.phtml
index 0b0166efd..8c482053b 100644
--- a/modules/monitoring/application/views/scripts/show/host.phtml
+++ b/modules/monitoring/application/views/scripts/show/host.phtml
@@ -5,6 +5,6 @@
 <?= $this->render('show/components/properties.phtml'); ?>
 <?= $this->render('show/components/flags.phtml'); ?>
 <?= $this->render('show/components/customvars.phtml'); ?>
-<?= $this->render('show/components/servicegroups.phtml'); ?>
+<?= $this->render('show/components/hostgroups.phtml'); ?>
 <?= $this->render('show/components/contacts.phtml'); ?>
 <?= $this->render('show/components/command.phtml') ?>
diff --git a/modules/monitoring/library/Monitoring/DataView/Customvar.php b/modules/monitoring/library/Monitoring/DataView/Customvar.php
new file mode 100644
index 000000000..fab68204b
--- /dev/null
+++ b/modules/monitoring/library/Monitoring/DataView/Customvar.php
@@ -0,0 +1,65 @@
+<?php
+// {{{ICINGA_LICENSE_HEADER}}}
+/**
+ * This file is part of Icinga 2 Web.
+ *
+ * Icinga 2 Web - Head for multiple monitoring backends.
+ * Copyright (C) 2013 Icinga Development Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * @copyright 2013 Icinga Development Team <info@icinga.org>
+ * @license   http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
+ * @author    Icinga Development Team <info@icinga.org>
+ */
+// {{{ICINGA_LICENSE_HEADER}}}
+
+namespace Icinga\Module\Monitoring\DataView;
+
+/**
+ * Represent customvar view
+ */
+class Customvar extends DataView
+{
+    /**
+     * Retrieve columns provided by this view
+     *
+     * @return array
+     */
+    public function getColumns()
+    {
+        return array(
+            'varname',
+            'varvalue',
+            'object_type'
+        );
+    }
+
+    /**
+     * Retrieve default sorting rules for particular columns. These involve sort order and potential additional to sort
+     *
+     * @return array
+     */
+    public function getSortRules()
+    {
+        return array(
+            'varname' => array(
+                'varname'  => self::SORT_ASC,
+                'varvalue' => self::SORT_ASC,
+            )
+        );
+    }
+}
diff --git a/modules/monitoring/library/Monitoring/Object/AbstractObject.php b/modules/monitoring/library/Monitoring/Object/AbstractObject.php
index 40ae632b5..33a653735 100644
--- a/modules/monitoring/library/Monitoring/Object/AbstractObject.php
+++ b/modules/monitoring/library/Monitoring/Object/AbstractObject.php
@@ -1,10 +1,40 @@
 <?php
+// {{{ICINGA_LICENSE_HEADER}}}
+/**
+ * This file is part of Icinga 2 Web.
+ *
+ * Icinga 2 Web - Head for multiple monitoring backends.
+ * Copyright (C) 2013 Icinga Development Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * @copyright 2013 Icinga Development Team <info@icinga.org>
+ * @license   http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
+ * @author    Icinga Development Team <info@icinga.org>
+ */
+// {{{ICINGA_LICENSE_HEADER}}}
 
 namespace Icinga\Module\Monitoring\Object;
 
 use Icinga\Data\AbstractQuery as Query;
 use \Icinga\Module\Monitoring\Backend;
 
+/**
+ * Generic icinga object with belongings
+ */
 abstract class AbstractObject
 {
     protected $backend;
@@ -17,14 +47,7 @@ abstract class AbstractObject
 
     protected $properties;
 
-    protected $foreign = array(
-        // 'hostgroups'    => null,
-        // 'contacts'      => null,
-        // 'contactgroups' => null,
-        // 'servicegroups' => null,
-        // 'customvars'    => null,
-        // 'comments'      => null,
-    );
+    protected $foreign = array();
 
     public function __construct(Backend $backend, $name1, $name2 = null)
     {
@@ -81,10 +104,13 @@ abstract class AbstractObject
     protected function fetchHostgroups()
     {
         $this->foreign['hostgroups'] = $this->applyObjectFilter(
-            $this->backend->select()->from('hostgroup', array(
-                'hostgroup_name',
-                'hostgroup_alias'
-            ))
+            $this->backend->select()->from(
+                'hostgroup',
+                array(
+                    'hostgroup_name',
+                    'hostgroup_alias'
+                )
+            )
         )->fetchPairs();
         return $this;
     }
@@ -92,10 +118,13 @@ abstract class AbstractObject
     protected function fetchServicegroups()
     {
         $this->foreign['servicegroups'] = $this->applyObjectFilter(
-            $this->backend->select()->from('servicegroup', array(
-                'servicegroup_name',
-                'servicegroup_alias'
-            ))
+            $this->backend->select()->from(
+                'servicegroup',
+                array(
+                    'servicegroup_name',
+                    'servicegroup_alias'
+                )
+            )
         )->fetchPairs();
         return $this;
     }
@@ -103,12 +132,15 @@ abstract class AbstractObject
     protected function fetchContacts()
     {
         $this->foreign['contacts'] = $this->applyObjectFilter(
-            $this->backend->select()->from('contact', array(
-                'contact_name',
-                'contact_alias',
-                'contact_email',
-                'contact_pager',
-            ))
+            $this->backend->select()->from(
+                'contact',
+                array(
+                    'contact_name',
+                    'contact_alias',
+                    'contact_email',
+                    'contact_pager',
+                )
+            )
         )->fetchAll();
         return $this;
     }
@@ -116,10 +148,13 @@ abstract class AbstractObject
     protected function fetchContactgroups()
     {
         $this->foreign['contactgroups'] = $this->applyObjectFilter(
-            $this->backend->select()->from('contactgroup', array(
-                'contactgroup_name',
-                'contactgroup_alias',
-            ))
+            $this->backend->select()->from(
+                'contactgroup',
+                array(
+                    'contactgroup_name',
+                    'contactgroup_alias',
+                )
+            )
         )->fetchAll();
         return $this;
     }
@@ -127,12 +162,15 @@ abstract class AbstractObject
     protected function fetchComments()
     {
         $this->foreign['comments'] = $this->applyObjectFilter(
-            $this->backend->select()->from('comment', array(
-                'comment_timestamp',
-                'comment_author',
-                'comment_data',
-                'comment_type',
-            ))->where('comment_objecttype_id', $this->type)
+            $this->backend->select()->from(
+                'comment',
+                array(
+                    'comment_timestamp',
+                    'comment_author',
+                    'comment_data',
+                    'comment_type',
+                )
+            )->where('comment_objecttype_id', $this->type)
         )->fetchAll();
         return $this;
     }
@@ -140,12 +178,13 @@ abstract class AbstractObject
     protected function fetchCustomvars()
     {
         $this->foreign['customvars'] = $this->applyObjectFilter(
-            $this->backend->select()->from('customvar', array(
-                'varname',
-                'varvalue'
-            ))
-            ->where('varname', '-*PW*,-*PASS*,-*COMMUNITY*')
-            ->where('object_type', 'host')
+            $this->backend->select()->from(
+                'customvar',
+                array(
+                    'varname',
+                    'varvalue'
+                )
+            )->where('varname', '-*PW*,-*PASS*,-*COMMUNITY*')
         )->fetchPairs();
         return $this;
     }
@@ -153,17 +192,20 @@ abstract class AbstractObject
     public function fetchEventHistory()
     {
         $this->foreign['eventHistory'] = $this->applyObjectFilter(
-            $this->backend->select()->from('eventHistory', array(
-                'object_type',
-                'host_name',
-                'service_description',
-                'timestamp',
-                'state',
-                'attempt',
-                'max_attempts',
-                'output',
-                'type'
-            ))
+            $this->backend->select()->from(
+                'eventHistory',
+                array(
+                    'object_type',
+                    'host_name',
+                    'service_description',
+                    'timestamp',
+                    'state',
+                    'attempt',
+                    'max_attempts',
+                    'output',
+                    'type'
+                )
+            )
         );
         return $this;
     }
@@ -171,7 +213,9 @@ abstract class AbstractObject
     public function fetchDowtimes()
     {
         $this->foreign['downtimes'] = $this->applyObjectFilter(
-            $this->backend->select()->from('downtime', array(
+            $this->backend->select()->from(
+                'downtime',
+                array(
                     'host_name',
                     'object_type',
                     'service_host_name',
diff --git a/modules/monitoring/library/Monitoring/Object/Host.php b/modules/monitoring/library/Monitoring/Object/Host.php
index ad540d49d..13b312f13 100644
--- a/modules/monitoring/library/Monitoring/Object/Host.php
+++ b/modules/monitoring/library/Monitoring/Object/Host.php
@@ -1,9 +1,39 @@
 <?php
+// {{{ICINGA_LICENSE_HEADER}}}
+/**
+ * This file is part of Icinga 2 Web.
+ *
+ * Icinga 2 Web - Head for multiple monitoring backends.
+ * Copyright (C) 2013 Icinga Development Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * @copyright 2013 Icinga Development Team <info@icinga.org>
+ * @license   http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
+ * @author    Icinga Development Team <info@icinga.org>
+ */
+// {{{ICINGA_LICENSE_HEADER}}}
 
 namespace Icinga\Module\Monitoring\Object;
 
 use Icinga\Data\AbstractQuery as Query;
 
+/**
+ * Represent a host object
+ */
 class Host extends AbstractObject
 {
     protected $foreign = array(
@@ -12,19 +42,35 @@ class Host extends AbstractObject
         'contactgroups' => null,
         'customvars'    => null,
         'comments'      => null,
-        'downtimes'     => null
+        'downtimes'     => null,
+        'customvars'    => null
     );
 
+    /**
+     * Statename
+     */
     public function stateName()
     {
         // TODO
     }
 
+    /**
+     * Filter object belongings
+     *
+     * @param   Query $query
+     *
+     * @return  Query
+     */
     protected function applyObjectFilter(Query $query)
     {
         return $query->where('host_name', $this->name1);
     }
 
+    /**
+     * Load foreign object data
+     *
+     * @return self
+     */
     public function prefetch()
     {
         return $this->fetchHostgroups()
@@ -32,48 +78,56 @@ class Host extends AbstractObject
             ->fetchContactgroups()
             ->fetchCustomvars()
             ->fetchComments()
-            ->fetchDowtimes();
+            ->fetchDowtimes()
+            ->fetchCustomvars();
     }
 
+    /**
+     * Load object data
+     * @return object
+     */
     protected function fetchObject()
     {
-        return $this->backend->select()->from('status', array(
-            'host_name',
-            'host_alias',
-            'host_address',
-            'host_state',
-            'host_handled',
-            'host_in_downtime',
-            'in_downtime' => 'host_in_downtime',
-            'host_acknowledged',
-            'host_last_state_change',
-            'last_state_change'         => 'host_last_state_change',
-            'last_notification'         => 'host_last_notification',
-            'last_check'                => 'host_last_check',
-            'next_check'                => 'host_next_check',
-            'check_execution_time'      => 'host_check_execution_time',
-            'check_latency'             => 'host_check_latency',
-            'output'                    => 'host_output',
-            'long_output'               => 'host_long_output',
-            'check_command'             => 'host_check_command',
-            'perfdata'                  => 'host_perfdata',
-            'host_icon_image',
-            'passive_checks_enabled'    => 'host_passive_checks_enabled',
-            'obsessing'                 => 'host_obsessing',
-            'notifications_enabled'     => 'host_notifications_enabled',
-            'event_handler_enabled'     => 'host_event_handler_enabled',
-            'flap_detection_enabled'    => 'host_flap_detection_enabled',
-            'active_checks_enabled'     => 'host_active_checks_enabled',
-            'current_check_attempt'     => 'host_current_check_attempt',
-            'max_check_attempts'        => 'host_max_check_attempts',
-            'last_notification' => 'host_last_notification',
-            'current_notification_number'   => 'host_current_notification_number',
-            'percent_state_change' => 'host_percent_state_change',
-            'is_flapping' => 'host_is_flapping',
-            'last_comment'              => 'host_last_comment',
-            'action_url'                => 'host_action_url',
-            'notes_url'                 => 'host_notes_url',
-            'percent_state_change'      => 'host_percent_state_change'
-        ))->where('host_name', $this->name1)->fetchRow();
+        return $this->backend->select()->from(
+            'status',
+            array(
+                'host_name',
+                'host_alias',
+                'host_address',
+                'host_state',
+                'host_handled',
+                'host_in_downtime',
+                'in_downtime'                   => 'host_in_downtime',
+                'host_acknowledged',
+                'host_last_state_change',
+                'last_state_change'             => 'host_last_state_change',
+                'last_notification'             => 'host_last_notification',
+                'last_check'                    => 'host_last_check',
+                'next_check'                    => 'host_next_check',
+                'check_execution_time'          => 'host_check_execution_time',
+                'check_latency'                 => 'host_check_latency',
+                'output'                        => 'host_output',
+                'long_output'                   => 'host_long_output',
+                'check_command'                 => 'host_check_command',
+                'perfdata'                      => 'host_perfdata',
+                'host_icon_image',
+                'passive_checks_enabled'        => 'host_passive_checks_enabled',
+                'obsessing'                     => 'host_obsessing',
+                'notifications_enabled'         => 'host_notifications_enabled',
+                'event_handler_enabled'         => 'host_event_handler_enabled',
+                'flap_detection_enabled'        => 'host_flap_detection_enabled',
+                'active_checks_enabled'         => 'host_active_checks_enabled',
+                'current_check_attempt'         => 'host_current_check_attempt',
+                'max_check_attempts'            => 'host_max_check_attempts',
+                'last_notification'             => 'host_last_notification',
+                'current_notification_number'   => 'host_current_notification_number',
+                'percent_state_change'          => 'host_percent_state_change',
+                'is_flapping'                   => 'host_is_flapping',
+                'last_comment'                  => 'host_last_comment',
+                'action_url'                    => 'host_action_url',
+                'notes_url'                     => 'host_notes_url',
+                'percent_state_change'          => 'host_percent_state_change'
+            )
+        )->where('host_name', $this->name1)->fetchRow();
     }
 }
diff --git a/modules/monitoring/library/Monitoring/Object/Service.php b/modules/monitoring/library/Monitoring/Object/Service.php
index 17e693acd..33cd4ff01 100644
--- a/modules/monitoring/library/Monitoring/Object/Service.php
+++ b/modules/monitoring/library/Monitoring/Object/Service.php
@@ -1,31 +1,82 @@
 <?php
+// {{{ICINGA_LICENSE_HEADER}}}
+/**
+ * This file is part of Icinga 2 Web.
+ *
+ * Icinga 2 Web - Head for multiple monitoring backends.
+ * Copyright (C) 2013 Icinga Development Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * @copyright 2013 Icinga Development Team <info@icinga.org>
+ * @license   http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
+ * @author    Icinga Development Team <info@icinga.org>
+ */
+// {{{ICINGA_LICENSE_HEADER}}}
 
 namespace Icinga\Module\Monitoring\Object;
 
 use Icinga\Data\AbstractQuery as Query;
 
+/**
+ * Represent a single service
+ */
 class Service extends AbstractObject
 {
+    /**
+     * Foreign references to objects
+     *
+     * @var array
+     */
     protected $foreign = array(
         'servicegroups' => null,
         'contacts'      => null,
         'contactgroups' => null,
         'customvars'    => null,
         'comments'      => null,
-        'downtimes'     => null
+        'downtimes'     => null,
+        'customvars'    => null
     );
 
+    /**
+     * Statename
+     */
     public function stateName()
     {
         // TODO
     }
 
+    /**
+     * Filter foreign object belongings
+     *
+     * @param   Query $query
+     *
+     * @return  Query
+     */
     protected function applyObjectFilter(Query $query)
     {
         return $query->where('service_host_name', $this->name1)
                      ->where('service_description', $this->name2);
     }
 
+    /**
+     * Collect foreign data
+     *
+     * @return self
+     */
     public function prefetch()
     {
         return $this->fetchServicegroups()
@@ -33,54 +84,63 @@ class Service extends AbstractObject
             ->fetchContactgroups()
             ->fetchCustomvars()
             ->fetchComments()
-            ->fetchDowtimes();
+            ->fetchDowtimes()
+            ->fetchCustomvars();
     }
 
+    /**
+     * Load object data
+     *
+     * @return object
+     */
     protected function fetchObject()
     {
-        return $this->backend->select()->from('status', array(
-            'host_name',
-            'host_alias',
-            'host_address',
-            'host_state',
-            'host_handled',
-            'host_in_downtime',
-            'host_acknowledged',
-            'host_last_state_change',
-            'service_description',
-            'service_state',
-            'service_handled',
-            'service_acknowledged',
-            'service_in_downtime',
-            'service_last_state_change',
-            'last_check'    => 'service_last_check',
-            'next_check'    => 'service_next_check',
-            'check_execution_time'    => 'service_check_execution_time',
-            'check_latency' => 'service_check_latency',
-            'output'        => 'service_output',
-            'long_output'   => 'service_long_output',
-            'check_command' => 'service_check_command',
-            'perfdata'      => 'service_perfdata',
-            'current_check_attempt' => 'service_current_check_attempt',
-            'max_check_attempts' => 'service_max_check_attempts',
-            'state_type' => 'service_state_type',
-            'passive_checks_enabled' => 'service_passive_checks_enabled',
-            'last_state_change' => 'service_last_state_change',
-            'last_notification' => 'service_last_notification',
-            'current_notification_number' => 'service_current_notification_number',
-            'is_flapping' => 'service_is_flapping',
-            'percent_state_change' => 'service_percent_state_change',
-            'in_downtime' => 'service_in_downtime',
-            'passive_checks_enabled'    => 'service_passive_checks_enabled',
-            'obsessing'                 => 'service_obsessing',
-            'notifications_enabled'     => 'service_notifications_enabled',
-            'event_handler_enabled'     => 'service_event_handler_enabled',
-            'flap_detection_enabled'    => 'service_flap_detection_enabled',
-            'active_checks_enabled'     => 'service_active_checks_enabled',
-            'last_comment'              => 'service_last_comment',
-            'action_url'                => 'service_action_url',
-            'notes_url'                 => 'service_notes_url'
-        ))
+        return $this->backend->select()->from(
+            'status',
+            array(
+                'host_name',
+                'host_alias',
+                'host_address',
+                'host_state',
+                'host_handled',
+                'host_in_downtime',
+                'host_acknowledged',
+                'host_last_state_change',
+                'service_description',
+                'service_state',
+                'service_handled',
+                'service_acknowledged',
+                'service_in_downtime',
+                'service_last_state_change',
+                'last_check'                    => 'service_last_check',
+                'next_check'                    => 'service_next_check',
+                'check_execution_time'          => 'service_check_execution_time',
+                'check_latency'                 => 'service_check_latency',
+                'output'                        => 'service_output',
+                'long_output'                   => 'service_long_output',
+                'check_command'                 => 'service_check_command',
+                'perfdata'                      => 'service_perfdata',
+                'current_check_attempt'         => 'service_current_check_attempt',
+                'max_check_attempts'            => 'service_max_check_attempts',
+                'state_type'                    => 'service_state_type',
+                'passive_checks_enabled'        => 'service_passive_checks_enabled',
+                'last_state_change'             => 'service_last_state_change',
+                'last_notification'             => 'service_last_notification',
+                'current_notification_number'   => 'service_current_notification_number',
+                'is_flapping'                   => 'service_is_flapping',
+                'percent_state_change'          => 'service_percent_state_change',
+                'in_downtime'                   => 'service_in_downtime',
+                'passive_checks_enabled'        => 'service_passive_checks_enabled',
+                'obsessing'                     => 'service_obsessing',
+                'notifications_enabled'         => 'service_notifications_enabled',
+                'event_handler_enabled'         => 'service_event_handler_enabled',
+                'flap_detection_enabled'        => 'service_flap_detection_enabled',
+                'active_checks_enabled'         => 'service_active_checks_enabled',
+                'last_comment'                  => 'service_last_comment',
+                'action_url'                    => 'service_action_url',
+                'notes_url'                     => 'service_notes_url'
+            )
+        )
         ->where('host_name', $this->name1)
         ->where('service_description', $this->name2)
         ->fetchRow();