diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java
index cf3334ddbcfa86d016f7e1c5c495e8b6394e0b57..d98cbba647e57f1d72c348ce31198e83e54b7df2 100644
--- a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java
+++ b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java
@@ -106,6 +106,10 @@ public class TopologyInstance {
     // in the cache.
     private final PathCacheLoader pathCacheLoader = new PathCacheLoader(this);
     protected LoadingCache<RouteId, Route> pathcache;
+
+    // routecache contains n (specified in floodlightdefault.properties) routes
+    // in order between every switch. Calculated using Yen's algorithm.
+    protected Map<RouteId, ArrayList<Route>> routecache;
 	
     public TopologyInstance(Map<DatapathId, Set<OFPort>> switchPorts,
                             Set<NodePortTuple> blockedPorts,
@@ -196,6 +200,9 @@ public class TopologyInstance {
         // Cost for tunnel links and direct links are the same.
 		calculateAllShortestPaths();
 
+        // Step 4.5 YENSSSSS
+        calculateAllOrderedRoutes();
+
         // Compute the archipelagos (def: cluster of islands). An archipelago will
         // simply be a group of connected islands. Each archipelago will have its own
         // finiteBroadcastTree which will be randomly chosen.
@@ -892,6 +899,25 @@ public class TopologyInstance {
 //        }
     }
 
+    /*
+    Calculates and stores n possible routes (specified in floodlightdefault.properties) using Yen's algorithm,
+    looping through every switch.
+    These lists of routes are stored in routecache.
+    */
+    protected void calculateAllOrderedRoutes() {
+        ArrayList<Route> routes;
+        RouteId routeId;
+        routecache.clear();
+
+        for (DatapathId src : switches) {
+            for (DatapathId dst : switches) {
+                routes = getRoutes(src, dst, 5); // Hard coded value needs to be replaced.
+                routeId = new RouteId(src, dst);
+                routecache.put(routeId, routes);
+            }
+        }
+    }
+
     protected void calculateShortestPathTreeInClusters() {
         pathcache.invalidateAll();
         destinationRootedTrees.clear();