diff --git a/lbry/wallet/server/db/trending/ar.py b/lbry/wallet/server/db/trending/ar.py
index bc20da4c7..4e8278dba 100644
--- a/lbry/wallet/server/db/trending/ar.py
+++ b/lbry/wallet/server/db/trending/ar.py
@@ -24,15 +24,17 @@ DECAY_PER_RENORM = DECAY**(RENORM_INTERVAL)
 TRENDING_LOG = True
 
 
-# Stubs
 def install(connection):
+    """
+    Install the AR trending algorithm.
+    """
     check_trending_values(connection)
 
     if TRENDING_LOG:
         f = open("trending_ar.log", "w")
         f.close()
 
-
+# Stub
 CREATE_TREND_TABLE = ""
 
 
@@ -109,14 +111,14 @@ class TrendingData:
         # Have all claims been read from db yet?
         self.initialised = False
 
-    def insert_claim_from_load(self, claim_id, trending_score, total_amount):
+    def insert_claim_from_load(self, claim_hash, trending_score, total_amount):
         assert not self.initialised
-        self.claims[claim_id] = {"trending_score": trending_score,
+        self.claims[claim_hash] = {"trending_score": trending_score,
                                  "total_amount": total_amount,
                                  "changed": False}
 
 
-    def update_claim(self, claim_id, total_amount, time_boost=1.0):
+    def update_claim(self, claim_hash, total_amount, time_boost=1.0):
         """
         Update trending data for a claim, given its new total amount.
         """
@@ -124,8 +126,8 @@ class TrendingData:
 
         # Extract existing total amount and trending score
         # or use starting values if the claim is new
-        if claim_id in self.claims:
-            old_state = copy.deepcopy(self.claims[claim_id])
+        if claim_hash in self.claims:
+            old_state = copy.deepcopy(self.claims[claim_hash])
         else:
             old_state = {"trending_score": 0.0,
                          "total_amount": 0.0,
@@ -141,9 +143,9 @@ class TrendingData:
                                  old_state["total_amount"],
                                  time_boost)
             trending_score = old_state["trending_score"] + spike
-            self.claims[claim_id] = {"total_amount": total_amount,
-                                     "trending_score": trending_score,
-                                     "changed": True}
+            self.claims[claim_hash] = {"total_amount": total_amount,
+                                       "trending_score": trending_score,
+                                       "changed": True}
 
 
 
@@ -213,7 +215,7 @@ def run(db, height, final_height, recalculate_claim_hashes):
     if not trending_data.initialised:
         # On fresh launch
         for row in db.execute("""
-                              SELECT claim_id, trending_mixed,
+                              SELECT claim_hash, trending_mixed,
                                      (amount + support_amount)
                                          AS total_amount
                               FROM claim;
@@ -222,7 +224,7 @@ def run(db, height, final_height, recalculate_claim_hashes):
         trending_data.initialised = True
     else:
         for row in db.execute(f"""
-                              SELECT claim_id,
+                              SELECT claim_hash,
                                      (amount + support_amount)
                                          AS total_amount
                               FROM claim
@@ -249,7 +251,7 @@ def run(db, height, final_height, recalculate_claim_hashes):
 
         trending_log("{n} scores to write...".format(n=len(the_list)))
 
-        db.executemany("UPDATE claim SET trending_mixed=? WHERE claim_id=?;",
+        db.executemany("UPDATE claim SET trending_mixed=? WHERE claim_hash=?;",
                        the_list)
 
         trending_log("done.\n")