diff --git a/ospfd/ospf_ia.c b/ospfd/ospf_ia.c
index 32c8d86..e4c1468 100644
--- a/ospfd/ospf_ia.c
+++ b/ospfd/ospf_ia.c
@@ -71,8 +71,9 @@
 }
 
 void
-ospf_ia_network_route (struct route_table *rt, struct prefix_ipv4 *p,
-                       struct ospf_route *new_or, struct ospf_route *abr_or)
+ospf_ia_network_route (struct ospf *ospf, struct route_table *rt,
+		       struct prefix_ipv4 *p, struct ospf_route *new_or,
+		       struct ospf_route *abr_or)
 {
   struct route_node *rn1;
   struct ospf_route *or;
@@ -94,7 +95,7 @@
 	    zlog_info ("ospf_ia_network_route(): "
 		       "Found a route to the same network");
 	  /* Check the existing route. */
-	  if ((res = ospf_route_cmp (new_or, or)) < 0)
+	  if ((res = ospf_route_cmp (ospf, new_or, or)) < 0)
 	    {
 	      /* New route is better, so replace old one. */
 	      ospf_route_subst (rn1, new_or, abr_or);
@@ -103,7 +104,7 @@
 	    {
 	      /* New and old route are equal, so next hops can be added. */
 	      route_lock_node (rn1);
-	      ospf_route_copy_nexthops (or, abr_or->path);
+	      ospf_route_copy_nexthops (or, abr_or->paths);
 	      route_unlock_node (rn1);
 
 	      /* new route can be deleted, because existing route has been updated. */
@@ -127,18 +128,19 @@
 }
 
 void
-ospf_ia_router_route (struct route_table *rt, struct prefix_ipv4 *p,
+ospf_ia_router_route (struct ospf *ospf, struct route_table *rtrs,
+		      struct prefix_ipv4 *p,
                       struct ospf_route *new_or, struct ospf_route *abr_or)
 {
-  struct route_node *rn;
   struct ospf_route *or = NULL;
+  struct route_node *rn;
   int ret;
 
   if (IS_DEBUG_OSPF_EVENT)
     zlog_info ("ospf_ia_router_route(): considering %s/%d", 
 	       inet_ntoa (p->prefix), p->prefixlen);
   /* Find a route to the same dest */
-  rn = route_node_get (rt,(struct prefix *) p);
+  rn = route_node_get (rtrs, (struct prefix *) p);
    
   if (rn->info == NULL)
     /* This is a new route */
@@ -146,11 +148,11 @@
   else
     {
       struct ospf_area *or_area;
-      or_area = ospf_area_lookup_by_area_id (new_or->u.std.area_id);
+      or_area = ospf_area_lookup_by_area_id (ospf, new_or->u.std.area_id);
       assert (or_area);
       /* This is an additional route */
       route_unlock_node (rn);
-      or = ospf_find_asbr_route_through_area (rt, p, or_area);
+      or = ospf_find_asbr_route_through_area (rtrs, p, or_area);
     }
 
   if (or)
@@ -159,7 +161,7 @@
 	zlog_info ("ospf_ia_router_route(): "
 		   "a route to the same ABR through the same area exists");
       /* New route is better */
-      if ((ret = ospf_route_cmp (new_or, or)) < 0)
+      if ((ret = ospf_route_cmp (ospf, new_or, or)) < 0)
 	{
 	  listnode_delete (rn->info, or);
 	  ospf_route_free (or);
@@ -171,7 +173,7 @@
 	  if (IS_DEBUG_OSPF_EVENT)
 	    zlog_info ("ospf_ia_router_route(): merging the new route");
 
-	  ospf_route_copy_nexthops (or, abr_or->path);
+	  ospf_route_copy_nexthops (or, abr_or->paths);
 	  ospf_route_free (new_or);
 	  return;
 	}
@@ -185,7 +187,7 @@
 	}
     }
 
-  ospf_route_copy_nexthops (new_or, abr_or->path);
+  ospf_route_copy_nexthops (new_or, abr_or->paths);
 
   if (IS_DEBUG_OSPF_EVENT)
     zlog_info ("ospf_ia_router_route(): adding the new route"); 
@@ -194,28 +196,21 @@
 }
 
 
-struct ia_args
-{
-  struct route_table *rt;
-  struct route_table *rtrs;
-  struct ospf_area *area;
-};
-
 int
-process_summary_lsa (struct ospf_lsa *l, void *v, int i)
+process_summary_lsa (struct ospf_area *area, struct route_table *rt,
+		     struct route_table *rtrs, struct ospf_lsa *lsa)
 {
+  struct ospf *ospf = area->ospf;
   struct ospf_area_range *range;
   struct ospf_route *abr_or, *new_or;
   struct summary_lsa *sl;
   struct prefix_ipv4 p, abr;
   u_int32_t metric;
-  struct ia_args *args;
 
-  if (l == NULL)
+  if (lsa == NULL)
     return 0;
 
-  args = (struct ia_args *) v;
-  sl = (struct summary_lsa *) l->data;
+  sl = (struct summary_lsa *) lsa->data;
 
   if (IS_DEBUG_OSPF_EVENT)
     zlog_info ("process_summary_lsa(): LS ID: %s", inet_ntoa (sl->header.id));
@@ -225,10 +220,10 @@
   if (metric == OSPF_LS_INFINITY)
     return 0;
 
-  if (IS_LSA_MAXAGE (l))
+  if (IS_LSA_MAXAGE (lsa))
     return 0;
 
-  if (ospf_lsa_is_self_originated (l))
+  if (ospf_lsa_is_self_originated (area->ospf, lsa))
     return 0;
 
   p.family = AF_INET;
@@ -242,12 +237,12 @@
   apply_mask_ipv4 (&p);
 
   if (sl->header.type == OSPF_SUMMARY_LSA &&
-      (range = ospf_area_range_match_any (ospf_top, &p)) &&
+      (range = ospf_area_range_match_any (ospf, &p)) &&
       ospf_area_range_active (range))
     return 0;
 
-  if (ospf_top->abr_type != OSPF_ABR_STAND &&
-      args->area->external_routing != OSPF_AREA_DEFAULT &&
+  if (ospf->abr_type != OSPF_ABR_STAND &&
+      area->external_routing != OSPF_AREA_DEFAULT &&
       p.prefix.s_addr == OSPF_DEFAULT_DESTINATION &&
       p.prefixlen == 0)
     return 0; /* Ignore summary default from a stub area */
@@ -257,7 +252,7 @@
   abr.prefixlen = IPV4_MAX_BITLEN;
   apply_mask_ipv4 (&abr);
 
-  abr_or = ospf_find_abr_route (args->rtrs, &abr, args->area);
+  abr_or = ospf_find_abr_route (rtrs, &abr, area);
 
   if (abr_or == NULL)
     return 0;
@@ -269,32 +264,35 @@
   new_or->u.std.options = sl->header.options;
   new_or->u.std.origin = (struct lsa_header *) sl;
   new_or->cost = abr_or->cost + metric;
-  new_or->u.std.area_id = args->area->area_id;
+  new_or->u.std.area_id = area->area_id;
 #ifdef HAVE_NSSA
-  new_or->u.std.external_routing = args->area->external_routing;
+  new_or->u.std.external_routing = area->external_routing;
 #endif /* HAVE_NSSA */
   new_or->path_type = OSPF_PATH_INTER_AREA;
 
   if (sl->header.type == OSPF_SUMMARY_LSA)
-    ospf_ia_network_route (args->rt, &p, new_or, abr_or);
+    ospf_ia_network_route (ospf, rt, &p, new_or, abr_or);
   else 
     {
       new_or->type = OSPF_DESTINATION_ROUTER;
       new_or->u.std.flags = ROUTER_LSA_EXTERNAL;
-      ospf_ia_router_route (args->rtrs, &p, new_or, abr_or);
+      ospf_ia_router_route (ospf, rtrs, &p, new_or, abr_or);
     }
 
   return 0;
 }
 
 void
-ospf_examine_summaries (struct ospf_area * area,
+ospf_examine_summaries (struct ospf_area *area,
 			struct route_table *lsdb_rt,
                         struct route_table *rt,
                         struct route_table *rtrs)
 {
-  struct ia_args args = {rt, rtrs, area};
-  foreach_lsa (lsdb_rt, &args, 0, process_summary_lsa);
+  struct ospf_lsa *lsa;
+  struct route_node *rn;
+
+  LSDB_LOOP (lsdb_rt, rn, lsa)
+    process_summary_lsa (area, rt, rtrs, lsa);
 }
 
 int
@@ -305,7 +303,8 @@
 }
 
 void
-ospf_update_network_route (struct route_table *rt, 
+ospf_update_network_route (struct ospf *ospf,
+			   struct route_table *rt, 
                            struct route_table *rtrs,
                            struct summary_lsa *lsa,
                            struct prefix_ipv4 *p,
@@ -336,7 +335,7 @@
 
   if (! rn)
     {
-      if (ospf_top->abr_type != OSPF_ABR_SHORTCUT)
+      if (ospf->abr_type != OSPF_ABR_SHORTCUT)
         return; /* Standard ABR can update only already installed
                    backbone paths                                       */
       if (IS_DEBUG_OSPF_EVENT)
@@ -375,7 +374,7 @@
       return;
     }
 
-  if (ospf_top->abr_type == OSPF_ABR_SHORTCUT)
+  if (ospf->abr_type == OSPF_ABR_SHORTCUT)
     {
       if (or->path_type == OSPF_PATH_INTRA_AREA &&
 	  !OSPF_IS_AREA_ID_BACKBONE (or->u.std.area_id))
@@ -409,7 +408,7 @@
       if (IS_DEBUG_OSPF_EVENT)
 	zlog_info ("ospf_update_network_route(): "
 		   "new route is same distance, adding nexthops");
-      ospf_route_copy_nexthops (or, abr_or->path);
+      ospf_route_copy_nexthops (or, abr_or->paths);
     }
 
   if (or->cost > cost)
@@ -417,10 +416,10 @@
       if (IS_DEBUG_OSPF_EVENT)
 	zlog_info ("ospf_update_network_route(): "
 		   "new route is better, overriding nexthops");
-      ospf_route_subst_nexthops (or, abr_or->path);
+      ospf_route_subst_nexthops (or, abr_or->paths);
       or->cost = cost;
 
-      if ((ospf_top->abr_type == OSPF_ABR_SHORTCUT) &&
+      if ((ospf->abr_type == OSPF_ABR_SHORTCUT) &&
 	  !OSPF_IS_AREA_ID_BACKBONE (or->u.std.area_id))
 	{
 	  or->path_type = OSPF_PATH_INTER_AREA;
@@ -437,7 +436,8 @@
 }
 
 void
-ospf_update_router_route (struct route_table *rtrs, 
+ospf_update_router_route (struct ospf *ospf,
+			  struct route_table *rtrs, 
                           struct summary_lsa *lsa,
                           struct prefix_ipv4 *p,
                           struct ospf_area *area)
@@ -465,17 +465,17 @@
   /* First try to find a backbone path,
      because standard ABR can update only BB-associated paths */
 
-  if ((ospf_top->backbone == NULL) &&
-      (ospf_top->abr_type != OSPF_ABR_SHORTCUT))
+  if ((ospf->backbone == NULL) &&
+      (ospf->abr_type != OSPF_ABR_SHORTCUT))
 
      /* no BB area, not Shortcut ABR, exiting */
      return;
  
-  or = ospf_find_asbr_route_through_area (rtrs, p, ospf_top->backbone);
+  or = ospf_find_asbr_route_through_area (rtrs, p, ospf->backbone);
 
   if (or == NULL)
     {
-      if (ospf_top->abr_type != OSPF_ABR_SHORTCUT)
+      if (ospf->abr_type != OSPF_ABR_SHORTCUT)
 
          /* route to ASBR through the BB not found
             the router is not Shortcut ABR, exiting */
@@ -500,7 +500,7 @@
 #endif /* HAVE_NSSA */
 	  new_or->path_type = OSPF_PATH_INTER_AREA;
 	  new_or->u.std.flags = ROUTER_LSA_EXTERNAL;
-	  ospf_ia_router_route (rtrs, p, new_or, abr_or);
+	  ospf_ia_router_route (ospf, rtrs, p, new_or, abr_or);
 
           return;
         }
@@ -523,11 +523,11 @@
     return;
 
   else if (or->cost == cost)
-    ospf_route_copy_nexthops (or, abr_or->path);
+    ospf_route_copy_nexthops (or, abr_or->paths);
 
   else if (or->cost > cost)
     {
-      ospf_route_subst_nexthops (or, abr_or->path);
+      ospf_route_subst_nexthops (or, abr_or->paths);
       or->cost = cost;
 
       /* Even if the ABR runs in Shortcut mode, we can't change
@@ -537,22 +537,22 @@
 }
 
 int
-process_transit_summary_lsa (struct ospf_lsa *l, void *v, int i)
+process_transit_summary_lsa (struct ospf_area *area, struct route_table *rt,
+			     struct route_table *rtrs, struct ospf_lsa *lsa)
 {
+  struct ospf *ospf = area->ospf;
   struct summary_lsa *sl;
   struct prefix_ipv4 p;
   u_int32_t metric;
-  struct ia_args *args;
 
-  if (l == NULL)
+  if (lsa == NULL)
     return 0;
 
-  args = (struct ia_args *) v;
-  sl = (struct summary_lsa *) l->data;
+  sl = (struct summary_lsa *) lsa->data;
 
   if (IS_DEBUG_OSPF_EVENT)
     zlog_info ("process_transit_summaries(): LS ID: %s",
-	       inet_ntoa (l->data->id));
+	       inet_ntoa (lsa->data->id));
   metric = GET_METRIC (sl->metric);
    
   if (metric == OSPF_LS_INFINITY)
@@ -562,14 +562,14 @@
       return 0;
     }
 
-  if (IS_LSA_MAXAGE (l))
+  if (IS_LSA_MAXAGE (lsa))
     {
       if (IS_DEBUG_OSPF_EVENT)
 	zlog_info ("process_transit_summaries(): This LSA is too old");
       return 0;
     }
 
-  if (ospf_lsa_is_self_originated (l))
+  if (ospf_lsa_is_self_originated (area->ospf, lsa))
     { 
       if (IS_DEBUG_OSPF_EVENT)
 	zlog_info ("process_transit_summaries(): This LSA is mine, skip");
@@ -587,28 +587,29 @@
   apply_mask_ipv4 (&p);
 
   if (sl->header.type == OSPF_SUMMARY_LSA)
-    ospf_update_network_route (args->rt, args->rtrs, sl, &p, args->area);
+    ospf_update_network_route (ospf, rt, rtrs, sl, &p, area);
   else
-    ospf_update_router_route (args->rtrs, sl, &p, args->area);
+    ospf_update_router_route (ospf, rtrs, sl, &p, area);
  
   return 0;
 }
 
 void
 ospf_examine_transit_summaries (struct ospf_area *area,
-                                /* struct ospf_lsdb *lsdb, */
 				struct route_table *lsdb_rt,
                                 struct route_table *rt,
                                 struct route_table *rtrs)
 {
-  struct ia_args args = {rt, rtrs, area};
+  struct ospf_lsa *lsa;
+  struct route_node *rn;
 
-  /* ospf_lsdb_iterator (lsdb, &args, 0, process_transit_summary_lsa); */
-  foreach_lsa (lsdb_rt, &args, 0, process_transit_summary_lsa);
+  LSDB_LOOP (lsdb_rt, rn, lsa)
+    process_transit_summary_lsa (area, rt, rtrs, lsa);
 }
 
 void
-ospf_ia_routing (struct route_table *rt,
+ospf_ia_routing (struct ospf *ospf,
+		 struct route_table *rt,
                  struct route_table *rtrs)
 {
   struct ospf_area * area;
@@ -616,18 +617,18 @@
   if (IS_DEBUG_OSPF_EVENT)
     zlog_info ("ospf_ia_routing():start");
 
-  if (OSPF_IS_ABR)
+  if (IS_OSPF_ABR (ospf))
     {
       listnode node; 
       struct ospf_area *area;
 
-      switch (ospf_top->abr_type)
+      switch (ospf->abr_type)
         {
         case OSPF_ABR_STAND:
 	  if (IS_DEBUG_OSPF_EVENT)
 	    zlog_info ("ospf_ia_routing():Standard ABR");
 
-          if ((area = ospf_top->backbone))
+          if ((area = ospf->backbone))
             {
               listnode node;
 
@@ -639,9 +640,9 @@
 
               OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
 
-	      for (node = listhead (ospf_top->areas); node; nextnode (node))
+	      for (node = listhead (ospf->areas); node; nextnode (node))
                 if ((area = getdata (node)) != NULL)
-                  if (area != ospf_top->backbone)
+                  if (area != ospf->backbone)
 		    if (ospf_area_is_transit (area))
 		      OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL (area, rt, rtrs);
             }
@@ -653,10 +654,10 @@
         case OSPF_ABR_CISCO:
 	  if (IS_DEBUG_OSPF_EVENT)
 	    zlog_info ("ospf_ia_routing():Alternative Cisco/IBM ABR");
-          area = ospf_top->backbone; /* Find the BB */
+          area = ospf->backbone; /* Find the BB */
 
           /* If we have an active BB connection */
-          if (area && ospf_act_bb_connection ())
+          if (area && ospf_act_bb_connection (ospf))
             {
 	      if (IS_DEBUG_OSPF_EVENT)
 		{
@@ -666,9 +667,9 @@
 
               OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
 
-	      for (node = listhead (ospf_top->areas); node; nextnode (node))
+	      for (node = listhead (ospf->areas); node; nextnode (node))
                 if ((area = getdata (node)) != NULL)
-                  if (area != ospf_top->backbone)
+                  if (area != ospf->backbone)
 		    if (ospf_area_is_transit (area))
 		      OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL (area, rt, rtrs);
             }
@@ -677,7 +678,7 @@
 	      if (IS_DEBUG_OSPF_EVENT)
 		zlog_info ("ospf_ia_routing(): "
 			   "Active BB connection not found");
-	      for (node = listhead (ospf_top->areas); node; nextnode (node))
+	      for (node = listhead (ospf->areas); node; nextnode (node))
                 if ((area = getdata (node)) != NULL)
                   OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
             }
@@ -685,10 +686,10 @@
         case OSPF_ABR_SHORTCUT:
 	  if (IS_DEBUG_OSPF_EVENT)
 	    zlog_info ("ospf_ia_routing():Alternative Shortcut");
-          area = ospf_top->backbone; /* Find the BB */
+          area = ospf->backbone; /* Find the BB */
 
           /* If we have an active BB connection */
-          if (area && ospf_act_bb_connection ())
+          if (area && ospf_act_bb_connection (ospf))
             {
 	      if (IS_DEBUG_OSPF_EVENT)
 		{
@@ -698,12 +699,12 @@
               OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
             }
 
-	  for (node = listhead (ospf_top->areas); node; nextnode (node))
+	  for (node = listhead (ospf->areas); node; nextnode (node))
             if ((area = getdata (node)) != NULL)
-              if (area != ospf_top->backbone)
+              if (area != ospf->backbone)
 		if (ospf_area_is_transit (area) ||
 		    ((area->shortcut_configured != OSPF_SHORTCUT_DISABLE) &&
-		     ((ospf_top->backbone == NULL) ||
+		     ((ospf->backbone == NULL) ||
                       ((area->shortcut_configured == OSPF_SHORTCUT_ENABLE) &&
 		       area->shortcut_capability))))
 		  OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL (area, rt, rtrs);
@@ -719,7 +720,7 @@
       if (IS_DEBUG_OSPF_EVENT)
 	zlog_info ("ospf_ia_routing():not ABR, considering all areas");
 
-      for (node = listhead (ospf_top->areas); node; nextnode (node))
+      for (node = listhead (ospf->areas); node; nextnode (node))
         if ((area = getdata (node)) != NULL)
           OSPF_EXAMINE_SUMMARIES_ALL (area, rt, rtrs);
     }
