diff --git a/Ganeti/HTools/Node.hs b/Ganeti/HTools/Node.hs
index c95f7f96d12a0571aa394a6beb6153f0b1111ad9..68f8300bbc4d768aa81bfab903c430dc46a2f3b9 100644
--- a/Ganeti/HTools/Node.hs
+++ b/Ganeti/HTools/Node.hs
@@ -154,7 +154,7 @@ buildPeers t il num_nodes =
                 (\i_idx -> let inst = Container.find i_idx il
                            in (Instance.pnode inst, Instance.mem inst))
                 (slist t)
-        pmap = PeerMap.accumArray (+) 0 (0, num_nodes - 1) mdata
+        pmap = PeerMap.accumArray (+) mdata
         new_rmem = computeMaxRes pmap
         new_failN1 = computeFailN1 new_rmem (f_mem t) (f_dsk t)
         new_prem = (fromIntegral new_rmem) / (t_mem t)
diff --git a/Ganeti/HTools/PeerMap.hs b/Ganeti/HTools/PeerMap.hs
index 9c142e917ab5c5e739ebded3ee740244cc64e43e..0f9af484fb79fd72adc618ec896afb1a8a13d26f 100644
--- a/Ganeti/HTools/PeerMap.hs
+++ b/Ganeti/HTools/PeerMap.hs
@@ -42,6 +42,7 @@ create _ = []
 pmCompare :: (Key, Elem) -> (Key, Elem) -> Ordering
 pmCompare a b = (compare `on` snd) b a
 
+-- | Add or update (via a custom function) an element
 addWith :: (Elem -> Elem -> Elem) -> Key -> Elem -> PeerMap -> PeerMap
 addWith fn k v lst =
     let r = lookup k lst
@@ -50,12 +51,14 @@ addWith fn k v lst =
         Nothing -> insertBy pmCompare (k, v) lst
         Just o -> insertBy pmCompare (k, fn o v) (remove k lst)
 
-accumArray :: (Elem -> Elem -> Elem) -> Elem -> (Key, Key) ->
-              [(Key, Elem)] -> PeerMap
-accumArray fn _ _ lst =
+-- | Create a PeerMap from an association list, with possible duplicates
+accumArray :: (Elem -> Elem -> Elem) -- ^ function used to merge the elements
+              -> [(Key, Elem)]       -- ^ source data
+              -> PeerMap             -- ^ results
+accumArray fn lst =
     case lst of
       [] -> empty
-      (k, v):xs -> addWith fn k v $ accumArray fn undefined undefined xs
+      (k, v):xs -> addWith fn k v $ accumArray fn xs
 
 find :: Key -> PeerMap -> Elem
 find k c = fromMaybe 0 $ lookup k c