diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java
index a25ad6e..bf77b77 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java
@@ -25,6 +25,7 @@
 import java.util.GregorianCalendar;
 import java.util.List;
 
+import org.onap.aaf.auth.batch.helpers.Approval;
 import org.onap.aaf.auth.dao.cass.ApprovalDAO;
 import org.onap.aaf.auth.dao.cass.NsDAO;
 import org.onap.aaf.auth.dao.cass.RoleDAO;
@@ -40,7 +41,11 @@
 import org.onap.aaf.misc.env.util.Chrono;
 
 public class URApprovalSet extends ApprovalSet {
-	
+	private static final String FMT_SUFFIX = "%s] - Expires %s";
+	private static final String EXTEND_ACCESS_FMT = Approval.RE_APPROVAL_IN_ROLE + "%s] to Role [" + FMT_SUFFIX;
+	private static final String REVALIDATE_AS_ADMIN_FMT = Approval.RE_VALIDATE_ADMIN + FMT_SUFFIX;
+	private static final String REVALIDATE_AS_OWNER_FMT = Approval.RE_VALIDATE_OWNER + FMT_SUFFIX;
+
 	public URApprovalSet(final AuthzTrans trans, final GregorianCalendar start, final DataView dv, final Loader<UserRoleDAO.Data> lurdd) throws IOException, CadiException {
 		super(start, "user_role", dv);
 		Organization org = trans.org();
@@ -132,15 +137,11 @@
 	private String getMemo(Data urdd) {
 		switch(urdd.rname) {
 		case "owner":
-			return String.format("Revalidate as Owner of AAF Namespace [%s] - Expires %s",
-					   urdd.ns,
-					   Chrono.dateOnlyStamp(urdd.expires));
+			return String.format(REVALIDATE_AS_OWNER_FMT,urdd.ns,Chrono.dateOnlyStamp(urdd.expires));
 		case "admin":
-			return String.format("Revalidate as Admin of AAF Namespace [%s] - Expires %s",
-					   urdd.ns,
-					   Chrono.dateOnlyStamp(urdd.expires));
+			return String.format(REVALIDATE_AS_ADMIN_FMT,urdd.ns,Chrono.dateOnlyStamp(urdd.expires));
 		default:
-			return String.format("Extend access of User [%s] to Role [%s] - Expires %s",
+			return String.format(EXTEND_ACCESS_FMT,
 					   urdd.user,
 					   urdd.role,
 					   Chrono.dateOnlyStamp(urdd.expires));
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
index dc96a1c..8aee4f8 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
@@ -23,9 +23,9 @@
 
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Set;
 import java.util.TreeMap;
 import java.util.UUID;
 
@@ -33,7 +33,6 @@
 import org.onap.aaf.auth.env.AuthzTrans;
 import org.onap.aaf.auth.layer.Result;
 import org.onap.aaf.cadi.util.CSV;
-import org.onap.aaf.misc.env.Env;
 import org.onap.aaf.misc.env.TimeTaken;
 import org.onap.aaf.misc.env.Trans;
 
@@ -44,9 +43,10 @@
 import com.datastax.driver.core.Statement;
 
 public class Approval implements CacheChange.Data  {
-    public static final String RE_APPROVAL_IN_ROLE = "Re-Approval in Role '";
-    public static final String RE_VALIDATE_ADMIN = "Re-Validate as Administrator for AAF Namespace '";
-    public static final String RE_VALIDATE_OWNER = "Re-Validate Ownership for AAF Namespace '";
+	public static final String ADD_USER_TO_ROLE = "Add User [";
+    public static final String RE_APPROVAL_IN_ROLE = "Extend access of User [";
+    public static final String RE_VALIDATE_ADMIN = "Revalidate as Admin of AAF Namespace [";
+    public static final String RE_VALIDATE_OWNER = "Revalidate as Owner of AAF Namespace [";
 
     public static TreeMap<String,List<Approval>> byApprover = new TreeMap<>();
     public static TreeMap<String,List<Approval>> byUser = new TreeMap<>();
@@ -77,118 +77,79 @@
         if (memo==null) {
             return null;
         }
-        int first = memo.indexOf('\'');
+        int first = memo.indexOf('[');
         if (first>=0) {
-            int second = memo.indexOf('\'', ++first);
+            int second = memo.indexOf(']', ++first);
             if (second>=0) {
                 String role = memo.substring(first, second);
                 if (memo.startsWith(RE_VALIDATE_ADMIN)) {
                     return role + ".admin";
                 } else if (memo.startsWith(RE_VALIDATE_OWNER)) {
                     return role + ".owner";
-                } else if (memo.startsWith(RE_APPROVAL_IN_ROLE)) {
-                    return role;
+                } else {
+                	first = memo.indexOf('[',second);
+                	if(first>=0) {
+                		second = memo.indexOf(']', ++first);
+                		if(second>=0) {
+                			if(memo.startsWith(RE_APPROVAL_IN_ROLE) ||
+                			   memo.startsWith(ADD_USER_TO_ROLE)) {
+                				return  memo.substring(first, second);
+                			}
+                		}
+                	}
                 }
             }
         }
         return null;
     }
 
-    public static void load(Trans trans, Session session, Creator<Approval> creator, Visitor<Approval> visitor) {
-        trans.info().log( "query: " + creator.select() );
-        TimeTaken tt = trans.start("Read Approval", Env.REMOTE);
-       
-        ResultSet results;
-        try {
-            Statement stmt = new SimpleStatement( creator.select() );
-            results = session.execute(stmt);
+    public static int load(Trans trans, Session session, Creator<Approval> creator, Visitor<Approval> visitor) {
+    	int count = 0;
+    	try {
+	    	count+=call(trans,session,creator.query(null), creator, visitor);
         } finally {
-            tt.done();
+            trans.info().log("Found",count,"Approval Records");
         }
-
-        int count = 0;
-        try {
-            Iterator<Row> iter = results.iterator();
-            Row row;
-            tt = trans.start("Load X509s", Env.SUB);
-            try {
-                while (iter.hasNext()) {
-                	++count;
-                    row = iter.next();
-                    visitor.visit(creator.create(row));
-                }
-            } finally {
-                tt.done();
-            }
-        } finally {
-            trans.info().log("Found",count,"X509 Certificates");
-        }
+    	return count;
     }
     
-	public static void row(CSV.RowSetter crs, Approval app) {
+	public static int load(Trans trans, Session session, Creator<Approval> creator ) {
+    	int count = 0;
+    	try {
+	    	count+=call(trans,session,creator.query(null), creator, FullLoad);
+        } finally {
+            trans.info().log("Found",count,"Approval Records");
+        }
+    	return count;
+    }
+    
+    public static int loadUsers(Trans trans, Session session, Set<String> users, Visitor<Approval> visitor) {
+		int total = 0;
+    	for(String user : users) {
+			total+=call(trans,session,String.format("%s WHERE user='%s';",v2_0_17.select(), user),v2_0_17,visitor);
+    	}
+    	return total;
+    }
+    
+    public static void row(CSV.RowSetter crs, Approval app) {
 		crs.row("approval",app.add.id,app.add.ticket,app.add.user,app.role,app.add.memo);
 	}
 
-
-    public static void load(Trans trans, Session session, Creator<Approval> creator ) {
-        trans.info().log( "query: " + creator.select() );
-        TimeTaken tt = trans.start("Load Notify", Env.REMOTE);
-       
+	private static int call(Trans trans, Session session, String query, Creator<Approval> creator, Visitor<Approval> visitor) {
+    	TimeTaken tt = trans.start("DB Query", Trans.REMOTE);
         ResultSet results;
         try {
-            Statement stmt = new SimpleStatement(creator.select());
+            Statement stmt = new SimpleStatement( query );
             results = session.execute(stmt);
+            int count = 0;
+            for (Row row : results.all()) {
+            	++count;
+            	visitor.visit(creator.create(row));
+            }
+            return count;
         } finally {
             tt.done();
         }
-        int count = 0;
-        tt = trans.start("Process Notify", Env.SUB);
-
-        try {
-                List<Approval> ln;
-                for (Row row : results.all()) {
-                    ++count;
-                    try {
-                            Approval app = creator.create(row);
-                            list.add(app);
-                            
-                            String person = app.getApprover();
-                            if (person!=null) {
-                            ln = byApprover.get(person);
-                                if (ln==null) {
-                                    ln = new ArrayList<>();
-                                    byApprover.put(app.getApprover(), ln);
-                                }
-                                ln.add(app);
-                            }
-                            
-                            
-                        person = app.getUser();
-                            if (person!=null) {
-                                ln = byUser.get(person);
-                                if (ln==null) {
-                                    ln = new ArrayList<>();
-                                    byUser.put(app.getUser(), ln);
-                                }
-                                ln.add(app);
-                            }
-                            UUID ticket = app.getTicket();
-                            if (ticket!=null) {
-                                ln = byTicket.get(ticket);
-                                if (ln==null) {
-                                    ln = new ArrayList<>();
-                                    byTicket.put(app.getTicket(), ln);
-                                }
-                            ln.add(app);
-                            }
-                    } finally {
-                        tt.done();
-                    }
-                }
-        } finally {
-            tt.done();
-            trans.info().log("Found",count,"Approval Records");
-        }
     }
     
     @Override
@@ -218,14 +179,6 @@
     	list.clear();
     	cache.resetLocalData();
     }
-//    public void update(AuthzTrans trans, ApprovalDAO apprDAO, boolean dryRun) {
-//        if (dryRun) {
-//            trans.info().printf("Would update Approval %s, %s, last_notified %s",add.id,add.status,add.last_notified);
-//        } else {
-//            trans.info().printf("Update Approval %s, %s, last_notified %s",add.id,add.status,add.last_notified);
-//            apprDAO.update(trans, add);
-//        }
-//    }
 
     public static Creator<Approval> v2_0_17 = new Creator<Approval>() {
         @Override
@@ -240,6 +193,43 @@
             return "select id,ticket,approver,user,memo,operation,status,type,WRITETIME(status) from authz.approval";
         }
     };
+    
+    public static Visitor<Approval> FullLoad = new Visitor<Approval>() {
+		@Override
+		public void visit(Approval app) {
+	        List<Approval> ln;
+	        list.add(app);
+	        
+	        String person = app.getApprover();
+	        if (person!=null) {
+	        ln = byApprover.get(person);
+	            if (ln==null) {
+	                ln = new ArrayList<>();
+	                byApprover.put(app.getApprover(), ln);
+	            }
+	            ln.add(app);
+	        }
+	        
+	        person = app.getUser();
+	        if (person!=null) {
+	            ln = byUser.get(person);
+	            if (ln==null) {
+	                ln = new ArrayList<>();
+	                byUser.put(app.getUser(), ln);
+	            }
+	            ln.add(app);
+	        }
+	        UUID ticket = app.getTicket();
+	        if (ticket!=null) {
+	            ln = byTicket.get(ticket);
+	            if (ln==null) {
+	                ln = new ArrayList<>();
+	                byTicket.put(app.getTicket(), ln);
+	            }
+	            ln.add(app);
+	        }
+		}
+    };
 
 //    /**
 //     * @return the lastNotified
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java
index 51400f8..eb998b0 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java
@@ -345,7 +345,6 @@
 			pendingTemp = null;
 			pendingApprs = null;
     	} finally {
-    		Approval.clear();
     	}
 			
 		/**
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java
index 2e51d07..8fa20ef 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java
@@ -57,11 +57,12 @@
 
 	@Test
 	public void testRoleFromMemo() {
-		Assert.assertNull(approval.roleFromMemo(null));
-		Assert.assertEquals(".admin",
-				approval.roleFromMemo("Re-Validate as Administrator for AAF Namespace '\'test\'test"));
-		Assert.assertEquals(".owner", approval.roleFromMemo("Re-Validate Ownership for AAF Namespace '\'test\'test"));
-		Assert.assertEquals("", approval.roleFromMemo("Re-Approval in Role '\'test\'test"));
+		Assert.assertNull(Approval.roleFromMemo(null));
+		Assert.assertEquals("org.onap.ns.admin",
+				Approval.roleFromMemo(Approval.RE_VALIDATE_ADMIN + "org.onap.ns]"));
+		Assert.assertEquals("org.onap.ns.owner", Approval.roleFromMemo(Approval.RE_VALIDATE_OWNER + "org.onap.ns]"));
+		Assert.assertEquals("org.onap.ns.member", Approval.roleFromMemo(Approval.RE_APPROVAL_IN_ROLE 
+				+ "bob] + [org.onap.ns.member] - Expires 2018-12-25"));
 	}
 
 	@Test
