 
     for(uint16_t graph_pos = 0; graph_pos < node_count; graph_pos++)
     {
-        //printf("%d\n", max_score_id);
         uint16_t node_id = graph[graph_pos];
-        //printf("node id %d\n", node_id);
         uint16_t in_edges = incoming_edge_count[node_id];
 
         int32_t score_node_id = scores[node_id];
+
+        // For each node, go through it's incoming edges.
+        // If the weight of any of the incoming edges is greater
+        // than the score of the current node, or if the weight is equal
+        // but the predecessors of the edge are heavier than the current node,
+        // then update the score of the node to be the incoming edge weight.
         for(uint16_t e = 0; e < in_edges; e++)
         {
             uint16_t edge_w = incoming_edge_w[node_id * CUDAPOA_MAX_NODE_EDGES + e];

            }
        }

        if (predecessors[node_id] != -1)
        {
            score_node_id += scores[predecessors[node_id]];
        }

        if (max_score < score_node_id)
        {
            max_score_id = node_id;

        scores[node_id] = score_node_id;
    }

    // If the node with maximum score isn't a leaf of the graph
    // then run a special branch completion function.
    if (outgoing_edge_count[max_score_id] != 0)
    {
        while(outgoing_edge_count[max_score_id] != 0)
