Index: branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3/HeuristicLab.Services.WebApp.Maintenance-3.3.csproj
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3/HeuristicLab.Services.WebApp.Maintenance-3.3.csproj	(revision 12765)
+++ branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3/HeuristicLab.Services.WebApp.Maintenance-3.3.csproj	(revision 12767)
@@ -40,30 +40,46 @@
     <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
       <Private>False</Private>
     </Reference>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Net.Http" />
+    <Reference Include="System">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Core">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Net.Http">
+      <Private>False</Private>
+    </Reference>
     <Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
       <Private>False</Private>
     </Reference>
     <Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
       <Private>False</Private>
     </Reference>
     <Reference Include="System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
       <Private>False</Private>
     </Reference>
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
+    <Reference Include="System.Xml.Linq">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Data.DataSetExtensions">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.CSharp">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Data">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Xml">
+      <Private>False</Private>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
@@ -79,10 +95,8 @@
     <Compile Include="WebApi\PluginController.cs" />
     <Compile Include="WebApi\SpaceUsageController.cs" />
-    <Compile Include="WebApi\CleanupController.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="app.config" />
     <None Include="HeuristicLab.snk" />
-    <None Include="packages.config" />
     <Content Include="WebApp\factclientinfo\factclientinfoCtrl.js">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
@@ -92,4 +106,8 @@
     </Content>
     <Content Include="WebApp\plugin\plugin.cshtml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <None Include="packages.config" />
+    <Content Include="Web.config">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
Index: branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3/WebApi/FactClientInfoController.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3/WebApi/FactClientInfoController.cs	(revision 12765)
+++ branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3/WebApi/FactClientInfoController.cs	(revision 12767)
@@ -65,63 +65,49 @@
       var factClientInfoDao = pm.FactClientInfoDao;
       var clientInfos = pm.UseTransaction(() => factClientInfoDao.GetByClientId(clientId).OrderBy(x => x.Time).ToList());
-      FactClientInfo lastClientInfo = null, sumClientInfo = new FactClientInfo();
-      int counter = 0;
-      var aggregatedClientInfos = new List<FactClientInfo>();
-      foreach (var clientInfo in clientInfos) {
-        if (lastClientInfo != null) {
-          if (lastClientInfo.SlaveState != clientInfo.SlaveState ||
-              lastClientInfo.IsAllowedToCalculate != clientInfo.IsAllowedToCalculate) {
-            // update into 'lastClientInfo'
-            if (aggregatedClientInfos.Any()) {
-              counter = aggregatedClientInfos.Count();
-              pm.UseTransaction(() => {
-                factClientInfoDao.Delete(aggregatedClientInfos);
-                lastClientInfo.NumUsedCores = sumClientInfo.NumUsedCores / counter;
-                lastClientInfo.NumTotalCores = sumClientInfo.NumTotalCores / counter;
-                lastClientInfo.UsedMemory = sumClientInfo.UsedMemory / counter;
-                lastClientInfo.TotalMemory = sumClientInfo.TotalMemory / counter;
-                lastClientInfo.CpuUtilization = sumClientInfo.CpuUtilization / counter;
-                lastClientInfo.IdleTime = sumClientInfo.IdleTime;
-                lastClientInfo.OfflineTime = sumClientInfo.OfflineTime;
-                lastClientInfo.UnavailableTime = sumClientInfo.UnavailableTime;
-                pm.SubmitChanges();
-              });
-            }
-            aggregatedClientInfos.Clear();
-            counter = 0;
-            sumClientInfo = new FactClientInfo();
-          } else {
-            // sum up 
-            sumClientInfo.NumUsedCores += clientInfo.NumUsedCores;
-            sumClientInfo.NumTotalCores += clientInfo.NumTotalCores;
-            sumClientInfo.UsedMemory += clientInfo.UsedMemory;
-            sumClientInfo.TotalMemory += clientInfo.TotalMemory;
-            sumClientInfo.CpuUtilization += clientInfo.CpuUtilization;
-            sumClientInfo.IdleTime += clientInfo.IdleTime;
-            sumClientInfo.OfflineTime += clientInfo.OfflineTime;
-            sumClientInfo.UnavailableTime += clientInfo.UnavailableTime;
-            counter++;
-            if (counter >= entries) {
-              pm.UseTransaction(() => {
-                factClientInfoDao.Delete(aggregatedClientInfos);
-                clientInfo.NumUsedCores = sumClientInfo.NumUsedCores / counter;
-                clientInfo.NumTotalCores = sumClientInfo.NumTotalCores / counter;
-                clientInfo.UsedMemory = sumClientInfo.UsedMemory / counter;
-                clientInfo.TotalMemory = sumClientInfo.TotalMemory / counter;
-                clientInfo.CpuUtilization = sumClientInfo.CpuUtilization / counter;
-                clientInfo.IdleTime = sumClientInfo.IdleTime;
-                clientInfo.OfflineTime = sumClientInfo.OfflineTime;
-                clientInfo.UnavailableTime = sumClientInfo.UnavailableTime;
-                pm.SubmitChanges();
-              });
-              aggregatedClientInfos.Clear();
-              counter = 0;
-              sumClientInfo = new FactClientInfo();
-            } else {
-              aggregatedClientInfos.Add(clientInfo);
-            }
-          }
+      var e = clientInfos.GetEnumerator();
+      if (!e.MoveNext()) return;
+      do {
+        var infosToAggregate = new List<FactClientInfo> { e.Current };
+        var prev = e.Current;
+        while (infosToAggregate.Count() != entries && e.MoveNext()) {
+          var cur = e.Current;
+          if (prev.IsAllowedToCalculate != cur.IsAllowedToCalculate || prev.SlaveState != cur.SlaveState)
+            break;
+          infosToAggregate.Add(cur);
+          prev = cur;
         }
-        lastClientInfo = clientInfo;
+        if (infosToAggregate.Count() == entries) {
+          AggregateClientInfos(pm, infosToAggregate);
+        }
+      } while (e.MoveNext());
+    }
+
+    private void AggregateClientInfos(IPersistenceManager pm, List<FactClientInfo> clientInfos) {
+      var factClientInfoDao = pm.FactClientInfoDao;
+      var last = clientInfos.Last();
+      var infos = clientInfos.GroupBy(x => x.ClientId).Select(x => new {
+        NumUsedCores = (int)x.Average(y => y.NumUsedCores),
+        NumTotalCores = (int)x.Average(y => y.NumTotalCores),
+        UsedMemory = (int)x.Average(y => y.UsedMemory),
+        TotalMemory = (int)x.Average(y => y.TotalMemory),
+        CpuUtilization = Math.Round(x.Average(y => y.CpuUtilization), 2),
+        IdleTime = x.Sum(y => y.IdleTime),
+        OfflineTime = x.Sum(y => y.OfflineTime),
+        UnavailableTime = x.Sum(y => y.UnavailableTime)
+      }).SingleOrDefault();
+      if (infos != null) {
+        pm.UseTransaction(() => {
+          last.NumUsedCores = infos.NumUsedCores;
+          last.NumTotalCores = infos.NumTotalCores;
+          last.UsedMemory = infos.UsedMemory;
+          last.TotalMemory = infos.TotalMemory;
+          last.CpuUtilization = infos.CpuUtilization;
+          last.IdleTime = infos.IdleTime;
+          last.OfflineTime = infos.OfflineTime;
+          last.UnavailableTime = infos.UnavailableTime;
+          clientInfos.Remove(last);
+          factClientInfoDao.Delete(clientInfos);
+          pm.SubmitChanges();
+        });
       }
     }
Index: branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3/WebApp/factclientinfo/factclientinfo.cshtml
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3/WebApp/factclientinfo/factclientinfo.cshtml	(revision 12765)
+++ branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3/WebApp/factclientinfo/factclientinfo.cshtml	(revision 12767)
@@ -54,8 +54,15 @@
                 <div class="panel-body">
                     <form class="form-inline">
-                        <p>
-                            Rows: {{factClientInfo.Rows}}<br/>
-                            Clients: {{factClientInfo.Clients}}
-                        </p>
+                        <div class="form-group" style="margin-left: 5px; margin-right: 5px;">
+                            <label>Rows:&nbsp;{{factClientInfo.Rows}}</label>
+                        </div>
+                        <div class="form-group" style="margin-left: 5px; margin-right: 5px;">
+                            <label>Clients:&nbsp;{{factClientInfo.Clients}}</label>
+                        </div>
+                        <div class="form-group" style="margin-left: 5px; margin-right: 5px;">
+                            <label for="entries">Entries:&nbsp;</label>
+                            <input id="entries" type="number" class="form-control"
+                                   ng-model="entries" min="2"/>
+                        </div>
                         <div class="form-group" style="margin-left: 5px; margin-right: 5px;">
                             <button type="button" class="btn btn-default" ng-click="aggregate()">
