diff --git a/src/main/java/com/rubix/WAMPAC/NMS/Constants/IPFSConstants.java b/src/main/java/com/rubix/WAMPAC/NMS/Constants/IPFSConstants.java
new file mode 100644
index 0000000000000000000000000000000000000000..7309cf2e41aeb425d7fbd1c3d5d7f77a809d4f4b
--- /dev/null
+++ b/src/main/java/com/rubix/WAMPAC/NMS/Constants/IPFSConstants.java
@@ -0,0 +1,7 @@
+package com.rubix.WAMPAC.NMS.Constants;
+
+public class IPFSConstants {
+    public static String addFolder = "ipfs add -r ";
+    public static String hashOnlyFolder = "ipfs add -nr ";
+
+}
diff --git a/src/main/java/com/rubix/WAMPAC/NMS/Constants/PathConstants.java b/src/main/java/com/rubix/WAMPAC/NMS/Constants/PathConstants.java
new file mode 100644
index 0000000000000000000000000000000000000000..932ba6e562c8a2847613508745ccf0e0f3f2d816
--- /dev/null
+++ b/src/main/java/com/rubix/WAMPAC/NMS/Constants/PathConstants.java
@@ -0,0 +1,61 @@
+package com.rubix.WAMPAC.NMS.Constants;
+
+import static com.rubix.Resources.Functions.getOsName;
+import static com.rubix.Resources.Functions.getSystemUser;
+
+public class PathConstants {
+
+    public static String RecoveryFolder = getRecoverPath();
+
+    private static String getRecoverPath() {
+        if(getOsName().contains("Linux"))
+            return "/home/" + getSystemUser() + "/Rubix/NMS/Recovered/";
+        else if(getOsName().contains("Mac"))
+            return "/Applications/Rubix/NMS/Recovered/";
+        else if(getOsName().contains("Windows"))
+            return "C:\\Rubix\\NMS\\Recovered\\";
+
+        return null;
+    }
+
+    public static String backupFolder = getBackupPath();
+
+    private static String getBackupPath() {
+        if(getOsName().contains("Linux"))
+            return "/home/" + getSystemUser() + "/Rubix/NMS/Backup/";
+        else if(getOsName().contains("Mac"))
+            return "/Applications/Rubix/NMS/Backup/";
+        else if(getOsName().contains("Windows"))
+            return "C:\\Rubix\\NMS\\Backup\\";
+
+        return null;
+    }
+
+    public static String logsFolder = getLogsPath();
+
+    private static String getLogsPath() {
+        if(getOsName().contains("Linux"))
+            return "/home/" + getSystemUser() + "/Rubix/NMS/Logs/";
+        else if(getOsName().contains("Mac"))
+            return "/Applications/Rubix/NMS/Logs/";
+        else if(getOsName().contains("Windows"))
+            return "C:\\Rubix\\NMS\\Logs\\";
+
+        return null;
+    }
+
+
+    public static String nmsFolder = getNMSPath();
+
+    private static String getNMSPath() {
+        if(getOsName().contains("Linux"))
+            return "/home/" + getSystemUser() + "/Rubix/NMS/";
+        else if(getOsName().contains("Mac"))
+            return "/Applications/Rubix/NMS/";
+        else if(getOsName().contains("Windows"))
+            return "C:\\Rubix\\NMS\\";
+
+        return null;
+    }
+
+}
diff --git a/src/main/java/com/rubix/WAMPAC/NMS/ExecuteTask.java b/src/main/java/com/rubix/WAMPAC/NMS/ExecuteTask.java
new file mode 100644
index 0000000000000000000000000000000000000000..fdc2513f0ee2bbf93cd693af098f998e5e5333f3
--- /dev/null
+++ b/src/main/java/com/rubix/WAMPAC/NMS/ExecuteTask.java
@@ -0,0 +1,160 @@
+package com.rubix.WAMPAC.NMS;
+
+import com.rubix.WAMPAC.NMS.LogsConsensus.LogInitConsensus;
+import com.rubix.WAMPAC.NMS.NLSS.Interact;
+import io.ipfs.api.IPFS;
+import io.ipfs.api.MerkleNode;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import static com.rubix.Resources.Functions.*;
+import static com.rubix.WAMPAC.NMS.Constants.PathConstants.*;
+import static com.rubix.WAMPAC.NMS.Resources.Functions.*;
+
+public class ExecuteTask implements Runnable{
+
+    @Override
+    public void run() {
+        pathSet();
+        Timer timer = new Timer();
+        File recovered = new File(RecoveryFolder);
+        if (!recovered.exists())
+            recovered.mkdirs();
+        File nms = new File(nmsFolder);
+        if (!nms.exists())
+            nms.mkdirs();
+        File logs = new File(logsFolder);
+        if (!logs.exists())
+            logs.mkdirs();
+        File backup = new File(backupFolder);
+        if (!backup.exists())
+            backup.mkdirs();
+
+        TimerTask loggerTask = new TimerTask() {
+            @Override
+            public void run() {
+                populateLogs();
+                List<MerkleNode> hashList = addFolder(logsFolder);
+                assert hashList != null;
+                String ipfsHashLog = (hashList.get(hashList.size() - 1).toString().substring(0, 46));
+                String peerID = getPeerID(DATA_PATH + "DID.json");
+                String did = getValues(DATA_PATH + "DID.json", "didHash", "peerid", peerID);
+                JSONObject logObject = new JSONObject();
+                try {
+                    logObject.put("logHash", ipfsHashLog);
+                    logObject.put("did", did);
+                    String signature = sign(logObject.toString());
+
+
+                    JSONArray allShares = new JSONArray();
+                    JSONObject q1 = new JSONObject();
+                    JSONObject q2 = new JSONObject();
+                    JSONObject q3 = new JSONObject();
+                    JSONObject q4 = new JSONObject();
+                    JSONObject q5 = new JSONObject();
+//                    q1.put("index",1);
+//                    q2.put("index",2);
+//                    q3.put("index",3);
+//                    q4.put("index",4);
+//                    q5.put("index",5);
+
+                    File logsfolder = new File(logsFolder);
+                    File[] logsFileNames = logsfolder.listFiles();
+                    File backupfolder = new File(backupFolder);
+                    File[] backupFileNames = backupfolder.listFiles();
+
+                    Boolean flag = false;
+                    for (int i = 0; i < Objects.requireNonNull(backupFileNames).length; i++) {
+                        String data = readFile(backupFileNames[i].getAbsolutePath());
+                        if (data.isEmpty())
+                            break;
+                        flag = true;
+                        String temp = convertToBinary(data);
+                        Interact interact = new Interact(temp);
+                        interact.sharecreate();
+                        if(interact.checkshare()){
+                            q1.put(backupFileNames[i].getName(),interact.secretstring);
+                            q2.put(backupFileNames[i].getName(),interact.y1string);
+                            q3.put(backupFileNames[i].getName(),interact.y2string);
+                            q4.put(backupFileNames[i].getName(),interact.y3string);
+                            q5.put(backupFileNames[i].getName(),interact.y4string);
+//                            System.out.println("recover: "+Interact.getback(interact.secretstring,interact.y1string));
+//                            System.out.println("recover: "+Interact.getback(interact.secretstring,interact.y2string));
+//                            System.out.println("recover: "+Interact.getback(interact.secretstring,interact.y3string));
+//                            System.out.println("recover: "+Interact.getback(interact.secretstring,interact.y4string));
+                            System.out.println("Secretshare  "+interact.secretstring);
+                        }else
+                            flag = false;
+//                        Split.split(temp);
+//                        int[][] shares = Split.get135Shares();
+//                        StringBuilder tempshare = new StringBuilder();
+//
+//                        for (int j = 0; j < shares[0].length; j++)
+//                            tempshare.append(shares[0][j]);
+//                        q1.put(backupFileNames[i].getName(),tempshare.toString());
+//
+//                        tempshare = new StringBuilder();
+//                        for (int j = 0; j < shares[1].length; j++)
+//                            tempshare.append(shares[1][j]);
+//                        q2.put(backupFileNames[i].getName(),tempshare.toString());
+//
+//                        tempshare = new StringBuilder();
+//                        for (int j = 0; j < shares[2].length; j++)
+//                            tempshare.append(shares[2][j]);
+//                        q3.put(backupFileNames[i].getName(),tempshare.toString());
+//
+//                        tempshare = new StringBuilder();
+//                        for (int j = 0; j < shares[3].length; j++)
+//                            tempshare.append(shares[3][j]);
+//                        q4.put(backupFileNames[i].getName(),tempshare.toString());
+//
+//                        tempshare = new StringBuilder();
+//                        for (int j = 0; j < shares[4].length; j++)
+//                            tempshare.append(shares[4][j]);
+//                        q5.put(backupFileNames[i].getName(),tempshare.toString());
+
+                    }
+
+                    allShares.put(q1);
+                    allShares.put(q2);
+                    allShares.put(q3);
+                    allShares.put(q4);
+                    allShares.put(q5);
+
+                    JSONArray logfiles = new JSONArray();
+                    for (int i = 0; i < Objects.requireNonNull(logsFileNames).length; i++) {
+                        String data = readFile(logsFileNames[i].getAbsolutePath());
+
+                        JSONObject temp = new JSONObject();
+                        temp.put(logsFileNames[i].getName(),data);
+                        logfiles.put(temp);
+                    }
+
+                    JSONObject payload = new JSONObject();
+                    payload.put("Hash", logObject.toString());
+                    payload.put("sign", signature);
+                    payload.put("shares", allShares);
+                    payload.put("logfiles",logfiles);
+
+                    if (flag) {
+                        IPFS ipfs = new IPFS("/ip4/127.0.0.1/tcp/" + IPFS_PORT);
+                        LogInitConsensus.start(payload.toString(), ipfs, 15040);
+                    }
+                } catch (JSONException | IOException e) {
+                    e.printStackTrace();
+                }
+
+            }
+        };
+
+        timer.schedule(loggerTask, 0L, 1000 * 60 * 60 * 6);
+    }
+}
diff --git a/src/main/java/com/rubix/WAMPAC/NMS/LogsConsensus/LogInitConsensus.java b/src/main/java/com/rubix/WAMPAC/NMS/LogsConsensus/LogInitConsensus.java
new file mode 100644
index 0000000000000000000000000000000000000000..bfa7e28a18fadb8b96f01aaa1a4ed8387f85ef75
--- /dev/null
+++ b/src/main/java/com/rubix/WAMPAC/NMS/LogsConsensus/LogInitConsensus.java
@@ -0,0 +1,362 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+package com.rubix.WAMPAC.NMS.LogsConsensus;
+
+
+import com.rubix.AuthenticateNode.Authenticate;
+import com.rubix.Resources.Functions;
+import com.rubix.WAMPAC.NMS.Recovery.RecoveryInit;
+import io.ipfs.api.IPFS;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.*;
+import java.net.Socket;
+import java.sql.Timestamp;
+import java.time.Instant;
+import java.util.ArrayList;
+
+import static com.rubix.Resources.Functions.*;
+import static com.rubix.WAMPAC.NMS.Constants.PathConstants.nmsFolder;
+import static com.rubix.WAMPAC.NMS.Resources.Functions.getVerifierIPList;
+
+public class LogInitConsensus {
+    public static Logger LogInitConsensusLogger = Logger.getLogger(LogInitConsensus.class);
+    private static Socket[] qSocket;
+    private static PrintStream[] qOut;
+    private static BufferedReader[] qIn;
+    private static String[] qResponse;
+    public static volatile JSONObject quorumSignature;
+    public static JSONArray allShares;
+    private static final Object countLock;
+    private static final Object signLock;
+    private static String[] quorumID;
+    public static ArrayList<String> quorumWithShares;
+    public static volatile String status = null;
+    public static volatile JSONArray verificationList,ipList;
+    public static volatile int quorumResponse;
+    public static volatile int count;
+    public static volatile int quorumConfirmationResponse;
+    public static volatile int quorumPosVerdict,quorumNegVerdict;
+
+
+
+    public LogInitConsensus() {
+    }
+
+    private static synchronized void voteNCount() {
+        PropertyConfigurator.configure(Functions.LOGGER_PATH + "log4jWallet.properties");
+        synchronized (countLock) {
+            ++quorumResponse;
+            if (quorumResponse >= Functions.minQuorum()) {
+                LogInitConsensusLogger.debug("Consensus Reached");
+            }
+
+        }
+    }
+
+
+    private static synchronized void confirmationCount(int votes) {
+        PropertyConfigurator.configure(Functions.LOGGER_PATH + "log4jWallet.properties");
+        synchronized (countLock) {
+            ++quorumConfirmationResponse;
+            if (quorumConfirmationResponse == votes) {
+                LogInitConsensusLogger.debug("Confirmation Reached");
+            }
+
+        }
+    }
+
+    private static synchronized void verdictPosCount() {
+        PropertyConfigurator.configure(Functions.LOGGER_PATH + "log4jWallet.properties");
+        synchronized (countLock) {
+            ++quorumPosVerdict;
+            LogInitConsensusLogger.debug("quorumPosVerdict " +quorumPosVerdict);
+
+        }
+    }
+
+    private static synchronized void verdictNegCount() {
+        PropertyConfigurator.configure(Functions.LOGGER_PATH + "log4jWallet.properties");
+        synchronized (countLock) {
+            ++quorumNegVerdict;
+            LogInitConsensusLogger.debug("quorumNegVerdict " + quorumNegVerdict);
+
+        }
+    }
+
+
+    private static synchronized void quorumSign(String quorumDID, String quorumResponse) {
+        PropertyConfigurator.configure(Functions.LOGGER_PATH + "log4jWallet.properties");
+        synchronized (signLock) {
+            try {
+                quorumSignature.put(quorumDID, quorumResponse);
+                if (quorumSignature.length() >= Functions.minQuorum()) {
+                    LogInitConsensusLogger.debug("Signatures length " + quorumSignature.length());
+                }
+            } catch (JSONException var5) {
+                LogInitConsensusLogger.error("JSON Exception Occurred", var5);
+                var5.printStackTrace();
+            }
+
+        }
+    }
+
+    private static synchronized void addtoSignatureDetails(JSONObject record) {
+        PropertyConfigurator.configure(Functions.LOGGER_PATH + "log4jWallet.properties");
+        synchronized (countLock) {
+            verificationList.put(record);
+        }
+    }
+
+    private static synchronized void setStatus(String stat) {
+        PropertyConfigurator.configure(Functions.LOGGER_PATH + "log4jWallet.properties");
+        synchronized (countLock) {
+            status = stat;
+        }
+    }
+
+    private static synchronized JSONObject getShareForIndex(String quorum) throws JSONException {
+        PropertyConfigurator.configure(Functions.LOGGER_PATH + "log4jWallet.properties");
+        synchronized (countLock) {
+            System.out.println("Added to list: "+quorum);
+            ipList.put(quorum);
+            if (count < minQuorum()) {
+                count++;
+            }
+            System.out.println("count "+(count-1)+" sending to "+quorum);
+            return allShares.getJSONObject(count - 1);
+        }
+    }
+
+    public static void start(String data, IPFS ipfs, int PORT) throws JSONException {
+        PropertyConfigurator.configure(Functions.LOGGER_PATH + "log4jWallet.properties");
+        JSONObject dataObject = new JSONObject(data);
+        String hash = dataObject.getString("Hash");
+        JSONArray logfiles = dataObject.getJSONArray("logfiles");
+        allShares = dataObject.getJSONArray("shares");
+//        String signature = dataObject.getString("sign");
+        JSONObject temp = new JSONObject(hash);
+        String log = temp.getString("logHash");
+        String did = temp.getString("did");
+        Timestamp instant= Timestamp.from(Instant.now());
+        String tid = calculateHash(log+instant,"SHA-256");
+
+        JSONArray quorumPeersObject = getVerifierIPList();
+        quorumResponse = 0;
+        quorumConfirmationResponse = 0;
+        quorumPosVerdict = 0;
+        quorumNegVerdict=0;
+        count = 0;
+        quorumSignature = new JSONObject();
+        verificationList = new JSONArray();
+        ipList = new JSONArray();
+        try {
+
+            int i;
+
+            for (int j = 0; j < quorumPeersObject.length(); ++j) {
+                quorumID[j] = quorumPeersObject.getString(j);
+            }
+
+            Thread[] quorumThreads = new Thread[quorumPeersObject.length()];
+
+            for (i = 0; i < quorumPeersObject.length(); ++i) {
+                int j = i;
+                quorumThreads[i] = new Thread(() -> {
+                    String var10000;
+                    try {
+//                        IPFSNetwork.swarmConnect(quorumID[j], ipfs);
+                        String peerID = Functions.getValues(DATA_PATH + "vip.json", "peerid", "ip", quorumID[j]);
+                        String quorumDidIpfsHash = Functions.getValues(Functions.DATA_PATH + "DataTable.json", "didHash", "peerid", peerID);
+                        String quorumWidIpfsHash = Functions.getValues(Functions.DATA_PATH + "DataTable.json", "walletHash", "peerid", peerID);
+                        Functions.nodeData(quorumDidIpfsHash, quorumWidIpfsHash, ipfs);
+//                        String appName = quorumID[j].concat("consensus");
+//                        IPFSNetwork.forward(appName, PORT + j, quorumID[j]);
+                        String var10001 = quorumID[j];
+                        LogInitConsensusLogger.debug("Connected to " + var10001);
+                        qSocket[j] = new Socket(quorumID[j], 15070);
+//                        qSocket[j].setSoTimeout(60*1000);
+                        qIn[j] = new BufferedReader(new InputStreamReader(qSocket[j].getInputStream()));
+                        qOut[j] = new PrintStream(qSocket[j].getOutputStream());
+                        dataObject.remove("shares");
+                        dataObject.put("tid",tid);
+                        qOut[j].println(dataObject);
+                        qResponse[j] = qIn[j].readLine();
+                        String quorumDidHash = qIn[j].readLine();
+
+//                        String quorumHash = qIn[j].readLine();
+                        //-----------------
+
+                        temp.put("did", quorumDidHash);
+                        String quorumHash = temp.toString();
+                        var10001 = quorumID[j];
+                        LogInitConsensusLogger.debug("Signature Received from " + var10001 + " " + qResponse[j]);
+                        if (quorumResponse > Functions.minQuorum()) {
+                            qOut[j].println("null");
+//                            var10000 = quorumID[j];
+//                            IPFSNetwork.executeIPFSCommands("ipfs p2p close -t /p2p/" + var10000);
+                            qOut[j].close();
+                            qIn[j].close();
+                        } else {
+                            String verifierPeerid = Functions.getValues(Functions.DATA_PATH + "vip.json", "peerid", "ip", quorumID[j]);
+                            String didHash = Functions.getValues(Functions.DATA_PATH + "dataTable.json", "didHash", "peerid", verifierPeerid);
+                            JSONObject detailsToVerify = new JSONObject();
+                            detailsToVerify.put("did", didHash);
+                            detailsToVerify.put("hash", calculateHash(quorumHash, "SHA3-256"));
+                            detailsToVerify.put("signature", qResponse[j]);
+                            if (Authenticate.verifySignature(detailsToVerify.toString())) {
+                                voteNCount();
+                                if (quorumResponse > Functions.minQuorum()) {
+                                    qOut[j].println("null");
+//                                        var10000 = quorumID[j];
+//                                        IPFSNetwork.executeIPFSCommands("ipfs p2p close -t /p2p/" + var10000);
+                                    qOut[j].close();
+                                    qIn[j].close();
+
+                                } else {
+
+                                    JSONObject record = new JSONObject();
+                                    record.put("hash", quorumHash);
+                                    record.put("sign", qResponse[j]);
+                                    addtoSignatureDetails(record);
+
+                                    while (verificationList.length() < Functions.minQuorum()) {
+                                        Thread.onSpinWait();
+                                    }
+
+                                    qOut[j].println(verificationList);
+                                    if (qIn[j].readLine().equals("Verification_Success"))
+                                        confirmationCount(verificationList.length());
+
+
+                                    while (quorumConfirmationResponse < Functions.minQuorum()) {
+                                        Thread.onSpinWait();
+                                    }
+
+                                    quorumSign(didHash, qResponse[j]);
+
+
+                                    qOut[j].println(logfiles);
+                                    String responseString = qIn[j].readLine();
+                                    LogInitConsensusLogger.debug("Received "+responseString+" from quorum "+quorumID[j]);
+
+                                    if (responseString.contains("restore"))
+                                        verdictPosCount();
+                                    else
+                                        verdictNegCount();
+
+                                    while (quorumPosVerdict+quorumNegVerdict < Functions.minQuorum()) {
+                                        Thread.onSpinWait();
+                                    }
+
+                                    if(quorumPosVerdict>((Functions.minQuorum())/2)){
+                                        qOut[j].println("restore");
+                                        setStatus("restore");
+                                        qOut[j].close();
+                                        qIn[j].close();
+                                    }
+                                    else{
+                                        qOut[j].println(getShareForIndex(quorumID[j]));
+                                        setStatus("backup");
+                                        qOut[j].close();
+                                        qIn[j].close();
+                                    }
+
+//------------------------------------------------------------------------------------------------------------
+//                                    quorumWithShares.add(quorumPeersObject.getString(j));
+//                                    int index = getShareIndex();
+//                                    JSONArray shareToQuorum = allShares.getJSONArray("q" + index);
+//                                    JSONObject sendToQuorum = new JSONObject();
+//                                    sendToQuorum.put("shareID", index);
+//                                    sendToQuorum.put("share", shareToQuorum);
+//                                    qOut[j].println(sendToQuorum);
+////                                    var10000 = quorumID[j];
+////                                    IPFSNetwork.executeIPFSCommands("ipfs p2p close -t /p2p/" +
+//                                    qOut[j].close();
+//                                    qIn[j].close();
+//----------------------------------------------------------------------------------------------------------
+                                }
+
+                                int var14 = quorumResponse;
+                                LogInitConsensusLogger.debug("Quorum Count : " + var14 + "Signature count : " + quorumSignature.length());
+                            }
+                        }
+                    } catch (JSONException | IOException var13) {
+                        var10000 = quorumID[j];
+//                        IPFSNetwork.executeIPFSCommands("ipfs p2p close -t /p2p/" + var10000);
+                        try {
+                            qOut[j].close();
+                            qIn[j].close();
+                        } catch (IOException e) {
+                            e.printStackTrace();
+                        }
+                        LogInitConsensusLogger.error("IOException Occurred", var13);
+                        var13.printStackTrace();
+                    }
+
+                });
+                quorumThreads[i].start();
+            }
+
+
+            do {
+                while (quorumResponse < Functions.minQuorum()) {
+                }
+            } while (status==null);
+
+            if(status.equals("backup"))
+                while (ipList.length()<Functions.minQuorum()) {}
+
+            LogInitConsensusLogger.debug("status is "+status);
+            if(status.equals("restore"))
+                RecoveryInit.Recover(did);
+
+            File logFile = new File(nmsFolder + "log.json");
+
+            JSONArray array;
+            if (!logFile.exists()) {
+                array = new JSONArray();
+                logFile.createNewFile();
+            }
+            else
+                array = new JSONArray(readFile( nmsFolder+ "log.json"));
+            for (int k = 0; k < verificationList.length(); k++) {
+                JSONObject record = verificationList.getJSONObject(k);
+                record.put("tid",tid);
+                record.put("timestamp",instant);
+                record.put("status",status);
+                record.put("quorumiplist",ipList);
+                array.put(verificationList.getJSONObject(k));
+
+            }
+            writeToFile(nmsFolder + "log.json", array.toString(), false);
+
+        } catch (JSONException var14) {
+            LogInitConsensusLogger.error("JSON Exception Occurred", var14);
+            var14.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    static {
+        qSocket = new Socket[Functions.QUORUM_COUNT];
+        qOut = new PrintStream[Functions.QUORUM_COUNT];
+        qIn = new BufferedReader[Functions.QUORUM_COUNT];
+        qResponse = new String[Functions.QUORUM_COUNT];
+        quorumSignature = new JSONObject();
+        countLock = new Object();
+        signLock = new Object();
+        quorumID = new String[Functions.QUORUM_COUNT];
+        quorumWithShares = new ArrayList();
+        quorumResponse = 0;
+    }
+}
diff --git a/src/main/java/com/rubix/WAMPAC/NMS/LogsConsensus/LogQuorumConsensus.java b/src/main/java/com/rubix/WAMPAC/NMS/LogsConsensus/LogQuorumConsensus.java
new file mode 100644
index 0000000000000000000000000000000000000000..df88cead79cdcbd7679cee4b5357af773bc04a2f
--- /dev/null
+++ b/src/main/java/com/rubix/WAMPAC/NMS/LogsConsensus/LogQuorumConsensus.java
@@ -0,0 +1,286 @@
+package com.rubix.WAMPAC.NMS.LogsConsensus;
+
+import com.rubix.AuthenticateNode.Authenticate;
+import com.rubix.Resources.Functions;
+import com.rubix.Resources.IPFSNetwork;
+import com.rubix.WAMPAC.NMS.logAnalysis.Analyze;
+import io.ipfs.api.IPFS;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.*;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.Iterator;
+
+
+import static com.rubix.Resources.Functions.*;
+import static com.rubix.WAMPAC.NMS.Constants.PathConstants.nmsFolder;
+
+public class LogQuorumConsensus implements Runnable {
+    public static Logger QuorumConsensusLogger = Logger.getLogger(com.rubix.Consensus.QuorumConsensus.class);
+    int port;
+    IPFS ipfs;
+
+    public LogQuorumConsensus() {
+        this.port = 15070;
+        this.ipfs = new IPFS("/ip4/127.0.0.1/tcp/" + Functions.IPFS_PORT);
+    }
+
+    public void run() {
+        while (true) {
+            PropertyConfigurator.configure(Functions.LOGGER_PATH + "log4jWallet.properties");
+            String senderDidIpfsHash = "";
+            String senderPID = "";
+            ServerSocket serverSocket = null;
+            Socket socket = null;
+
+            try {
+                String peerID = Functions.getPeerID(Functions.DATA_PATH + "DID.json");
+                String didHash = Functions.getValues(Functions.DATA_PATH + "DataTable.json", "didHash", "peerid", peerID);
+//                String appName = peerID.concat("consensus");
+//                IPFSNetwork.listen(appName, this.port);
+                QuorumConsensusLogger.debug("Quorum Listening on " + this.port);
+                serverSocket = new ServerSocket(this.port);
+                socket = serverSocket.accept();
+                System.out.println("Accepted");
+                BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+                PrintStream out = new PrintStream(socket.getOutputStream());
+                String getData = in.readLine();
+                QuorumConsensusLogger.debug("Received Details from initiator: " + getData);
+                JSONObject readSenderData = new JSONObject(getData);
+                String tid = readSenderData.getString("tid");
+                readSenderData.remove("tid");
+                String senderPrivatePos = readSenderData.getString("sign");
+//                senderDidIpfsHash = readSenderData.getString("senderDID");
+
+//                String transactionID = readSenderData.getString("Tid");
+                String verifySenderHash = readSenderData.getString("Hash");
+                JSONObject temp = new JSONObject(verifySenderHash);
+                senderDidIpfsHash = temp.getString("did");
+//                String receiverDID = readSenderData.getString("RID");
+                senderPID = Functions.getValues(Functions.DATA_PATH + "DataTable.json", "peerid", "didHash", senderDidIpfsHash);
+                String senderWidIpfsHash = Functions.getValues(Functions.DATA_PATH + "DataTable.json", "walletHash", "didHash", senderDidIpfsHash);
+//                Functions.nodeData(senderDidIpfsHash, senderWidIpfsHash, this.ipfs);
+//                String quorumHash = Functions.calculateHash(verifySenderHash.concat(receiverDID), "SHA3-256");
+                JSONObject detailsToVerify = new JSONObject();
+                detailsToVerify.put("did", senderDidIpfsHash);
+//                detailsToVerify.put("hash", verifySenderHash);
+                detailsToVerify.put("hash", calculateHash(verifySenderHash, "SHA3-256"));
+                detailsToVerify.put("signature", senderPrivatePos);
+                if (Authenticate.verifySignature(detailsToVerify.toString())) {
+                    QuorumConsensusLogger.debug("Quorum Authenticated Sender");
+//                    String QuorumSignature = Functions.getSignFromShares(Functions.DATA_PATH + didHash + "/PrivateShare.png", quorumHash);
+                    JSONObject hashToSign = new JSONObject(verifySenderHash);
+                    hashToSign.put("did", didHash);
+                    verifySenderHash = hashToSign.toString();
+                    String QuorumSignature = sign(verifySenderHash);
+                    out.println(QuorumSignature);
+                    out.println(didHash);
+
+                    String list = in.readLine();
+                    if (list.contains("null")) {
+                        socket.close();
+                        serverSocket.close();
+                    } else {
+                        JSONArray listOfSign = new JSONArray(list);
+                        Boolean flag = true;
+                        for (int i = 0; i < listOfSign.length(); i++) {
+                            JSONObject record = listOfSign.getJSONObject(i);
+                            String hash = record.getString("hash");
+                            JSONObject temprecord = new JSONObject(hash);
+                            String did = temprecord.getString("did");
+                            if (!did.equals(didHash)) {
+                                String sign = record.getString("sign");
+                                detailsToVerify = new JSONObject();
+                                detailsToVerify.put("did", did);
+                                detailsToVerify.put("hash", calculateHash(hash, "SHA3-256"));
+                                detailsToVerify.put("signature", sign);
+                                if (!Authenticate.verifySignature(detailsToVerify.toString())) {
+                                    flag = false;
+                                    break;
+                                }
+                            }
+                        }
+                        if (flag) {
+                            out.println("Verification_Success");
+                            String info = in.readLine();
+
+                            JSONArray log = new JSONArray(info);
+                            File logFile = new File(nmsFolder+senderDidIpfsHash);
+                            if(!logFile.exists())
+                                logFile.mkdirs();
+
+                            for (int i = 0; i < log.length(); i++) {
+                                JSONObject logRecord = log.getJSONObject(i);
+                                Iterator<String> keys = logRecord.keys();
+
+                                while(keys.hasNext()) {
+                                    String key = keys.next();
+                                    writeToFile(logFile+"\\"+key,logRecord.getString(key),false);
+                                }
+                            }
+                            String status;
+                            if(Analyze.rawAnalyze(senderDidIpfsHash))
+                                status = "restore";
+                            else
+                                status = "backup";
+
+                            out.println(status);
+
+                            String response = in.readLine();
+                            if(response.contains("restore")){
+
+                                File unsafe = new File(nmsFolder+"unsafe.json");
+                                JSONArray records;
+                                if(!unsafe.exists()) {
+                                    records = new JSONArray();
+                                    unsafe.createNewFile();
+                                }
+                                else
+                                    records = new JSONArray(readFile(unsafe.getAbsolutePath()));
+
+                                boolean found = false;
+                                JSONObject record;
+                                for (int i = 0; i < records.length(); i++) {
+                                    record = records.getJSONObject(i);
+                                    if(record.has(senderDidIpfsHash)){
+                                        found = true;
+                                        int count = record.getInt(senderDidIpfsHash);
+                                        count++;
+                                        record.put(senderDidIpfsHash,count);
+                                        records.remove(i);
+                                        records.put(record);
+                                        writeToFile(unsafe.getAbsolutePath(),records.toString(),false);
+                                        break;
+                                    }
+                                }
+
+                                if(!found){
+                                    record = new JSONObject();
+                                    record.put(senderDidIpfsHash,1);
+                                    records.put(record);
+                                    writeToFile(unsafe.getAbsolutePath(),records.toString(),false);
+                                }
+
+                                JSONObject storeDetailsQuorum = new JSONObject();
+                                storeDetailsQuorum.put("tid", tid);
+                                storeDetailsQuorum.put("loghash", temp.getString("logHash"));
+                                storeDetailsQuorum.put("sign", senderPrivatePos);
+                                storeDetailsQuorum.put("status", "restore");
+//                                File nms = new File(nmsFolder+"\\"+senderDidIpfsHash);
+//                                if (!nms.exists())
+//                                    nms.mkdirs();
+
+                                File senderDIDFile = new File(logFile + "\\log.json");
+                                JSONArray data;
+                                if(!senderDIDFile.exists()) {
+                                    data = new JSONArray();
+                                    senderDIDFile.createNewFile();
+                                }
+                                else
+                                    data = new JSONArray(readFile(logFile + "\\log.json"));
+                                data.put(storeDetailsQuorum);
+                                Functions.writeToFile(senderDIDFile.getAbsolutePath(),data.toString(),false);
+                            }
+                            else{
+                                JSONObject share = new JSONObject(response);
+//                                int index = details.getInt("shareID");
+                                if (!share.equals("null")) {
+                                    FileWriter shareWriter = new FileWriter("MyShare.txt", true);
+                                    shareWriter.write(share.toString());
+                                    shareWriter.close();
+                                    File readShare = new File("MyShare.txt");
+                                    String shareHash = IPFSNetwork.add(readShare.toString(), this.ipfs);
+                                    JSONObject storeDetailsQuorum = new JSONObject();
+                                    storeDetailsQuorum.put("tid", tid);
+                                    storeDetailsQuorum.put("loghash", temp.getString("logHash"));
+                                    storeDetailsQuorum.put("sign", senderPrivatePos);
+                                    storeDetailsQuorum.put("share", shareHash);
+//                                    storeDetailsQuorum.put("Shareid", index);
+                                    storeDetailsQuorum.put("status", status);
+//                                    File nms = new File(nmsFolder+"\\"+senderDidIpfsHash);
+//                                    if (!nms.exists())
+//                                        nms.mkdirs();
+
+                                    File senderDIDFile = new File(logFile + "\\log.json");
+                                    JSONArray data;
+                                    if(!senderDIDFile.exists()) {
+                                        data = new JSONArray();
+                                        senderDIDFile.createNewFile();
+                                    }
+                                    else
+                                        data = new JSONArray(readFile(logFile + "\\log.json"));
+                                    data.put(storeDetailsQuorum);
+                                    QuorumConsensusLogger.debug("Quorum Share: " + share);
+                                    Functions.writeToFile(senderDIDFile.getAbsolutePath(),data.toString(),false);
+                                    Functions.deleteFile("MyShare.txt");
+                            }
+
+
+                            }
+                        } else {
+                            QuorumConsensusLogger.debug("Quorum Authentication Failure - Quorum");
+                            out.println("Auth_Failed");
+                        }
+                    }
+
+
+                } else {
+                    QuorumConsensusLogger.debug("Sender Authentication Failure - Quorum");
+                    out.println("Auth_Failed");
+                }
+            } catch (IOException var37) {
+//                IPFSNetwork.executeIPFSCommands(" ipfs p2p close -t /p2p/" + senderPID);
+                try {
+                    socket.close();
+                    serverSocket.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+                QuorumConsensusLogger.error("IOException Occurred", var37);
+                var37.printStackTrace();
+            } catch (JSONException var38) {
+//                IPFSNetwork.executeIPFSCommands(" ipfs p2p close -t /p2p/" + senderPID);
+                try {
+                    socket.close();
+                    serverSocket.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+                QuorumConsensusLogger.error("JSONException Occurred", var38);
+                var38.printStackTrace();
+            } finally {
+                try {
+//                    IPFSNetwork.executeIPFSCommands(" ipfs p2p close -t /p2p/" + senderPID);
+                    socket.close();
+                    serverSocket.close();
+                } catch (IOException var36) {
+//                    IPFSNetwork.executeIPFSCommands(" ipfs p2p close -t /p2p/" + senderPID);
+                    try {
+                        socket.close();
+                        serverSocket.close();
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                    QuorumConsensusLogger.error("IOException Occurred", var36);
+                    var36.printStackTrace();
+                }
+
+            }
+        }
+    }
+
+//    public static void main(String[] args) {
+//        pathSet();
+//        LogQuorumConsensus q1 = new LogQuorumConsensus();
+//        q1.run();
+//
+//    }
+}
+
+
diff --git a/src/main/java/com/rubix/WAMPAC/NMS/NLSS/Functions.java b/src/main/java/com/rubix/WAMPAC/NMS/NLSS/Functions.java
new file mode 100644
index 0000000000000000000000000000000000000000..811584f212d2cfde58324c5807ad2c0d628275cb
--- /dev/null
+++ b/src/main/java/com/rubix/WAMPAC/NMS/NLSS/Functions.java
@@ -0,0 +1,79 @@
+package com.rubix.WAMPAC.NMS.NLSS;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+
+public class Functions {
+
+    public static String converttobinary(String strs){
+        strs=strs.replaceAll("\\s+","");
+        byte[] bytes = strs.getBytes();
+        StringBuilder binary = new StringBuilder();
+        for (byte b : bytes){
+            int val = b;
+            for (int i = 0; i < 8; i++){
+                binary.append((val & 128) == 0 ? 0 : 1);
+                val <<= 1;
+            }
+            binary.append(' ');
+        }
+        return binary.toString();
+    }
+
+    public static String readFile(String filePath) throws IOException {
+        FileReader fileReader = new FileReader(filePath);
+        StringBuilder fileContent = new StringBuilder();
+
+        int i;
+        while((i = fileReader.read()) != -1) {
+            fileContent.append((char)i);
+        }
+
+        fileReader.close();
+        return fileContent.toString();
+    }
+
+    public static void writeToFile(String filePath, String data, Boolean appendStatus) throws IOException {
+        File writeFile = new File(filePath);
+        FileWriter fw = new FileWriter(writeFile, appendStatus);
+        fw.write(data);
+        fw.close();
+    }
+
+
+    public static int factor(int x){
+        ArrayList arrayList = new ArrayList<Integer>();
+        int i,mid;
+        for (i = 1; i < x/2; i++) {
+            if(x%i==0)
+                arrayList.add(i);
+        }
+
+        mid = (int) arrayList.get((arrayList.size()/2));
+        return mid;
+    }
+
+    public static String intToBinary(int a) {
+        String temp = Integer.toBinaryString(a);
+        while(temp.length() !=8){
+            temp = "0"+temp;
+        }
+        return temp;
+    }
+    public static String binarytoDec(String bin)
+    {
+        System.out.println(bin.length());
+        StringBuilder result = new StringBuilder();
+        int val;
+        for(int i = 0; i < bin.length(); i +=8) {
+            val = Integer.parseInt(bin.substring(i, i+8), 2);
+            result.append(val);
+            result.append(' ');
+        }
+        return result.toString();
+    }
+
+}
diff --git a/src/main/java/com/rubix/WAMPAC/NMS/NLSS/Interact.java b/src/main/java/com/rubix/WAMPAC/NMS/NLSS/Interact.java
new file mode 100644
index 0000000000000000000000000000000000000000..63ad9886ca3576c8b0295da92e8674ca8dca5be2
--- /dev/null
+++ b/src/main/java/com/rubix/WAMPAC/NMS/NLSS/Interact.java
@@ -0,0 +1,181 @@
+package com.rubix.WAMPAC.NMS.NLSS;
+
+import java.io.IOException;
+
+public class Interact
+{
+    public String secretstring="", y1string ="",y2string="",y3string="",y4string="",y5string="",y6string="",bits,strs;
+    public StringBuilder pvt, cnd1,cnd2,cnd3,cnd4,cnd5,cnd6;
+    public int cand1[][],cand2[][],cand3[][],cand4[][],cand5[][],cand6[][],secret[][];
+
+    public Interact(String s){
+        bits = s ;
+    }
+
+
+
+    public void sharecreate()
+    {
+        bits=bits.replaceAll("\\s+","");
+        System.out.println(bits.length());
+        int i,j;
+        secret= new int[bits.length()][8];
+        cand1 = new int[bits.length()][8];
+        cand2 = new int[bits.length()][8];
+        cand3 = new int[bits.length()][8];
+        cand4 = new int[bits.length()][8];
+//        cand5 = new int[bits.length()][8];
+//        cand6 = new int[bits.length()][8];
+
+        SecretShare share;
+        pvt = new StringBuilder();
+        cnd1 = new StringBuilder();
+        cnd2 = new StringBuilder();
+        cnd3 = new StringBuilder();
+        cnd4 = new StringBuilder();
+//        cnd5 = new StringBuilder();
+//        cnd6 = new StringBuilder();
+        for(i=0;i<bits.length();i++)
+        {
+            if(bits.charAt(i)=='0')
+            {
+                share = new SecretShare(0);
+                share.starts();
+                for(j=0;j<8;j++)
+                {
+                    secret[i][j]=share.S0[j];
+                    cand1[i][j]=share.Y1[j];
+                    cand2[i][j]=share.Y2[j];
+                    cand3[i][j]=share.Y3[j];
+                    cand4[i][j]=share.Y4[j];
+//                    cand5[i][j]=share.Y5[j];
+//                    cand6[i][j]=share.Y6[j];
+
+                    pvt.append(share.S0[j]);
+                    cnd1.append(share.Y1[j]);
+                    cnd2.append(share.Y2[j]);
+                    cnd3.append(share.Y3[j]);
+                    cnd4.append(share.Y4[j]);
+//                    cnd5.append(share.Y5[j]);
+//                    cnd6.append(share.Y6[j]);
+                }
+            }
+            if(bits.charAt(i)=='1')
+            {
+                share = new SecretShare(1);
+                share.starts();
+                for(j=0;j<8;j++)
+                {
+                    secret[i][j]=share.S0[j];
+                    cand1[i][j]=share.Y1[j];
+                    cand2[i][j]=share.Y2[j];
+                    cand3[i][j]=share.Y3[j];
+                    cand4[i][j]=share.Y4[j];
+//                    cand5[i][j]=share.Y5[j];
+//                    cand6[i][j]=share.Y6[j];
+
+                    pvt.append(share.S0[j]);
+                    cnd1.append(share.Y1[j]);
+                    cnd2.append(share.Y2[j]);
+                    cnd3.append(share.Y3[j]);
+                    cnd4.append(share.Y4[j]);
+//                    cnd5.append(share.Y5[j]);
+//                    cnd6.append(share.Y6[j]);
+                }
+            }
+
+        }
+
+        secretstring = pvt.toString();
+        y1string = cnd1.toString();
+        y2string = cnd2.toString();
+        y3string = cnd3.toString();
+        y4string = cnd4.toString();
+//        y5string = cnd5.toString();
+//        y6string = cnd6.toString();
+
+
+    }
+    public boolean checkshare() throws IOException {
+        int i,j,sum1,sum2,sum3,sum4,sum5,sum6;
+        boolean verified = true;
+
+        for(i=0;i<secret.length;i++){
+            sum1=0;sum2=0;sum3=0;sum4=0;sum5=0;sum6=0;
+            for(j=0;j<secret[i].length;j++) {
+                sum1 += secret[i][j] * cand1[i][j];
+                sum2 += secret[i][j] * cand2[i][j];
+                sum3 += secret[i][j] * cand3[i][j];
+                sum4 += secret[i][j] * cand4[i][j];
+//                sum5 += secret[i][j] * cand5[i][j];
+//                sum6 += secret[i][j] * cand6[i][j];
+            }
+            sum1%=2;
+            sum2%=2;
+            sum3%=2;
+            sum4%=2;
+//            sum5%=2;
+//            sum6%=2;
+
+
+
+            if(sum1!=(bits.charAt(i)-48)|sum2!=(bits.charAt(i)-48)|sum3!=(bits.charAt(i)-48)|sum4!=(bits.charAt(i)-48)/*|sum5!=(bits.charAt(i)-48)|sum6!=(bits.charAt(i)-48)*/)
+                verified = false;
+
+
+        }
+        if(verified==true)
+        {
+            System.out.println("Verified :Correct");
+//            Functions.writeToFile("pvtshare.txt",secretstring,false);
+//            Functions.writeToFile("candshare1.txt",y1string,false);
+//            Functions.writeToFile("candshare2.txt",y2string,false);
+//            Functions.writeToFile("candshare3.txt",y3string,false);
+//            Functions.writeToFile("candshare4.txt",y4string,false);
+//            Functions.writeToFile("candshare5.txt",y5string,false);
+//            Functions.writeToFile("candshare6.txt",y6string,false);
+
+//            System.out.println(secretstring.length());
+//            System.out.println(y1string.length());
+            return true;
+        }
+        else
+            System.out.println("Verified :Wrong");
+            return false;
+
+    }
+
+    public static String getback(String s1,String s2) throws IOException {
+        int i,j,temp,temp1,sum;
+        if(s1.length()!=s2.length()||s1.length()<1){
+            System.out.println("Shares corrupted");
+            return "Shares corrupted";
+        }
+
+        StringBuilder tempo = new StringBuilder(),result = new StringBuilder();
+
+        char nextChar;
+        for(i=0;i<s1.length();i+=8){
+            sum=0;
+            for(j=i;j<i+8;j++){
+                temp = s1.charAt(j)-'0';
+                temp1 = s2.charAt(j)-'0';
+                sum+=temp*temp1;
+            }
+            sum%=2;
+            tempo.append(sum);
+        }
+
+        for(i = 0; i < tempo.length(); i +=8)
+        {
+            nextChar = (char)Integer.parseInt(tempo.substring(i, i+8), 2);
+            result.append(nextChar);
+        }
+        return result.toString();
+    }
+
+
+
+}
+
+
diff --git a/src/main/java/com/rubix/WAMPAC/NMS/NLSS/SecretShare.java b/src/main/java/com/rubix/WAMPAC/NMS/NLSS/SecretShare.java
new file mode 100644
index 0000000000000000000000000000000000000000..b79d5631456849c83e4fe9257f96e3a3727e0c68
--- /dev/null
+++ b/src/main/java/com/rubix/WAMPAC/NMS/NLSS/SecretShare.java
@@ -0,0 +1,316 @@
+package com.rubix.WAMPAC.NMS.NLSS;
+
+import java.util.Random;
+
+public class SecretShare
+{
+    public static int[][] LA = {{0, 0, 0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 0,
+            1, 1}, {0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 1}, {0, 0, 0, 0,
+            0, 1, 1, 0}, {0, 0, 0, 0, 0, 1, 1, 1}, {0, 0, 0, 0, 1, 0, 0, 0}, {0, 0,
+            0, 0, 1, 0, 0, 1}, {0, 0, 0, 0, 1, 0, 1, 0}, {0, 0, 0, 0, 1, 0, 1, 1},
+            {0, 0, 0, 0, 1, 1, 0, 0}, {0, 0, 0, 0, 1, 1, 0, 1}, {0, 0, 0, 0, 1, 1,
+            1, 0}, {0, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 1}, {0, 0, 0, 1,
+            0, 0, 1, 0}, {0, 0, 0, 1, 0, 0, 1, 1}, {0, 0, 0, 1, 0, 1, 0, 0}, {0, 0,
+            0, 1, 0, 1, 0, 1}, {0, 0, 0, 1, 0, 1, 1, 0}, {0, 0, 0, 1, 0, 1, 1, 1},
+            {0, 0, 0, 1, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 0, 0, 1}, {0, 0, 0, 1, 1, 0,
+            1, 0}, {0, 0, 0, 1, 1, 0, 1, 1}, {0, 0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 1,
+            1, 1, 0, 1}, {0, 0, 0, 1, 1, 1, 1, 0}, {0, 0, 0, 1, 1, 1, 1, 1}, {0, 0,
+            1, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 1}, {0, 0, 1, 0, 0, 0, 1, 0},
+            {0, 0, 1, 0, 0, 0, 1, 1}, {0, 0, 1, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 1,
+            0, 1}, {0, 0, 1, 0, 0, 1, 1, 0}, {0, 0, 1, 0, 0, 1, 1, 1}, {0, 0, 1, 0,
+            1, 0, 0, 0}, {0, 0, 1, 0, 1, 0, 0, 1}, {0, 0, 1, 0, 1, 0, 1, 0}, {0, 0,
+            1, 0, 1, 0, 1, 1}, {0, 0, 1, 0, 1, 1, 0, 0}, {0, 0, 1, 0, 1, 1, 0, 1},
+            {0, 0, 1, 0, 1, 1, 1, 0}, {0, 0, 1, 0, 1, 1, 1, 1}, {0, 0, 1, 1, 0, 0,
+            0, 0}, {0, 0, 1, 1, 0, 0, 0, 1}, {0, 0, 1, 1, 0, 0, 1, 0}, {0, 0, 1, 1,
+            0, 1, 0, 0}, {0, 0, 1, 1, 0, 1, 0, 1}, {0, 0, 1, 1, 0, 1, 1, 0}, {0, 0,
+            1, 1, 0, 1, 1, 1}, {0, 0, 1, 1, 1, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0, 1},
+            {0, 0, 1, 1, 1, 0, 1, 0}, {0, 0, 1, 1, 1, 0, 1, 1}, {0, 0, 1, 1, 1, 1,
+            0, 1}, {0, 0, 1, 1, 1, 1, 1, 0}, {0, 0, 1, 1, 1, 1, 1, 1}, {0, 1, 0, 0,
+            0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 1}, {0, 1, 0, 0, 0, 0, 1, 0}, {0, 1,
+            0, 0, 0, 0, 1, 1}, {0, 1, 0, 0, 0, 1, 0, 0}, {0, 1, 0, 0, 0, 1, 0, 1},
+            {0, 1, 0, 0, 0, 1, 1, 0}, {0, 1, 0, 0, 0, 1, 1, 1}, {0, 1, 0, 0, 1, 0,
+            0, 0}, {0, 1, 0, 0, 1, 0, 0, 1}, {0, 1, 0, 0, 1, 0, 1, 0}, {0, 1, 0, 0,
+            1, 0, 1, 1}, {0, 1, 0, 0, 1, 1, 0, 0}, {0, 1, 0, 0, 1, 1, 0, 1}, {0, 1,
+            0, 0, 1, 1, 1, 0}, {0, 1, 0, 0, 1, 1, 1, 1}, {0, 1, 0, 1, 0, 0, 0, 0},
+            {0, 1, 0, 1, 0, 0, 0, 1}, {0, 1, 0, 1, 0, 0, 1, 0}, {0, 1, 0, 1, 0, 0,
+            1, 1}, {0, 1, 0, 1, 0, 1, 0, 0}, {0, 1, 0, 1, 0, 1, 1, 0}, {0, 1, 0, 1,
+            0, 1, 1, 1}, {0, 1, 0, 1, 1, 0, 0, 0}, {0, 1, 0, 1, 1, 0, 0, 1}, {0, 1,
+            0, 1, 1, 0, 1, 1}, {0, 1, 0, 1, 1, 1, 0, 0}, {0, 1, 0, 1, 1, 1, 0, 1},
+            {0, 1, 0, 1, 1, 1, 1, 0}, {0, 1, 0, 1, 1, 1, 1, 1}, {0, 1, 1, 0, 0, 0,
+            0, 0}, {0, 1, 1, 0, 0, 0, 0, 1}, {0, 1, 1, 0, 0, 0, 1, 0}, {0, 1, 1, 0,
+            0, 0, 1, 1}, {0, 1, 1, 0, 0, 1, 0, 0}, {0, 1, 1, 0, 0, 1, 0, 1}, {0, 1,
+            1, 0, 0, 1, 1, 1}, {0, 1, 1, 0, 1, 0, 0, 0}, {0, 1, 1, 0, 1, 0, 1, 0},
+            {0, 1, 1, 0, 1, 0, 1, 1}, {0, 1, 1, 0, 1, 1, 0, 0}, {0, 1, 1, 0, 1, 1,
+            0, 1}, {0, 1, 1, 0, 1, 1, 1, 0}, {0, 1, 1, 0, 1, 1, 1, 1}, {0, 1, 1, 1,
+            0, 0, 0, 0}, {0, 1, 1, 1, 0, 0, 0, 1}, {0, 1, 1, 1, 0, 0, 1, 0}, {0, 1,
+            1, 1, 0, 0, 1, 1}, {0, 1, 1, 1, 0, 1, 0, 0}, {0, 1, 1, 1, 0, 1, 0, 1},
+            {0, 1, 1, 1, 0, 1, 1, 0}, {0, 1, 1, 1, 0, 1, 1, 1}, {0, 1, 1, 1, 1, 0,
+            0, 0}, {0, 1, 1, 1, 1, 0, 0, 1}, {0, 1, 1, 1, 1, 0, 1, 0}, {0, 1, 1, 1,
+            1, 0, 1, 1}, {0, 1, 1, 1, 1, 1, 0, 0}, {0, 1, 1, 1, 1, 1, 0, 1}, {0, 1,
+            1, 1, 1, 1, 1, 0}, {0, 1, 1, 1, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 0, 0},
+            {1, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 1, 0}, {1, 0, 0, 0, 0, 0,
+            1, 1}, {1, 0, 0, 0, 0, 1, 0, 0}, {1, 0, 0, 0, 0, 1, 0, 1}, {1, 0, 0, 0,
+            0, 1, 1, 0}, {1, 0, 0, 0, 0, 1, 1, 1}, {1, 0, 0, 0, 1, 0, 0, 0}, {1, 0,
+            0, 0, 1, 0, 0, 1}, {1, 0, 0, 0, 1, 0, 1, 0}, {1, 0, 0, 0, 1, 0, 1, 1},
+            {1, 0, 0, 0, 1, 1, 0, 0}, {1, 0, 0, 0, 1, 1, 0, 1}, {1, 0, 0, 0, 1, 1,
+            1, 0}, {1, 0, 0, 0, 1, 1, 1, 1}, {1, 0, 0, 1, 0, 0, 0, 0}, {1, 0, 0, 1,
+            0, 0, 0, 1}, {1, 0, 0, 1, 0, 0, 1, 0}, {1, 0, 0, 1, 0, 0, 1, 1}, {1, 0,
+            0, 1, 0, 1, 0, 0}, {1, 0, 0, 1, 0, 1, 0, 1}, {1, 0, 0, 1, 0, 1, 1, 1},
+            {1, 0, 0, 1, 1, 0, 0, 0}, {1, 0, 0, 1, 1, 0, 1, 0}, {1, 0, 0, 1, 1, 0,
+            1, 1}, {1, 0, 0, 1, 1, 1, 0, 0}, {1, 0, 0, 1, 1, 1, 0, 1}, {1, 0, 0, 1,
+            1, 1, 1, 0}, {1, 0, 0, 1, 1, 1, 1, 1}, {1, 0, 1, 0, 0, 0, 0, 0}, {1, 0,
+            1, 0, 0, 0, 0, 1}, {1, 0, 1, 0, 0, 0, 1, 0}, {1, 0, 1, 0, 0, 0, 1, 1},
+            {1, 0, 1, 0, 0, 1, 0, 0}, {1, 0, 1, 0, 0, 1, 1, 0}, {1, 0, 1, 0, 0, 1,
+            1, 1}, {1, 0, 1, 0, 1, 0, 0, 0}, {1, 0, 1, 0, 1, 0, 0, 1}, {1, 0, 1, 0,
+            1, 0, 1, 1}, {1, 0, 1, 0, 1, 1, 0, 0}, {1, 0, 1, 0, 1, 1, 0, 1}, {1, 0,
+            1, 0, 1, 1, 1, 0}, {1, 0, 1, 0, 1, 1, 1, 1}, {1, 0, 1, 1, 0, 0, 0, 0},
+            {1, 0, 1, 1, 0, 0, 0, 1}, {1, 0, 1, 1, 0, 0, 1, 0}, {1, 0, 1, 1, 0, 0,
+            1, 1}, {1, 0, 1, 1, 0, 1, 0, 0}, {1, 0, 1, 1, 0, 1, 0, 1}, {1, 0, 1, 1,
+            0, 1, 1, 0}, {1, 0, 1, 1, 0, 1, 1, 1}, {1, 0, 1, 1, 1, 0, 0, 0}, {1, 0,
+            1, 1, 1, 0, 0, 1}, {1, 0, 1, 1, 1, 0, 1, 0}, {1, 0, 1, 1, 1, 0, 1, 1},
+            {1, 0, 1, 1, 1, 1, 0, 0}, {1, 0, 1, 1, 1, 1, 0, 1}, {1, 0, 1, 1, 1, 1,
+            1, 0}, {1, 0, 1, 1, 1, 1, 1, 1}, {1, 1, 0, 0, 0, 0, 0, 0}, {1, 1, 0, 0,
+            0, 0, 0, 1}, {1, 1, 0, 0, 0, 0, 1, 0}, {1, 1, 0, 0, 0, 1, 0, 0}, {1, 1,
+            0, 0, 0, 1, 0, 1}, {1, 1, 0, 0, 0, 1, 1, 0}, {1, 1, 0, 0, 0, 1, 1, 1},
+            {1, 1, 0, 0, 1, 0, 0, 0}, {1, 1, 0, 0, 1, 0, 0, 1}, {1, 1, 0, 0, 1, 0,
+            1, 0}, {1, 1, 0, 0, 1, 0, 1, 1}, {1, 1, 0, 0, 1, 1, 0, 1}, {1, 1, 0, 0,
+            1, 1, 1, 0}, {1, 1, 0, 0, 1, 1, 1, 1}, {1, 1, 0, 1, 0, 0, 0, 0}, {1, 1,
+            0, 1, 0, 0, 0, 1}, {1, 1, 0, 1, 0, 0, 1, 0}, {1, 1, 0, 1, 0, 0, 1, 1},
+            {1, 1, 0, 1, 0, 1, 0, 0}, {1, 1, 0, 1, 0, 1, 0, 1}, {1, 1, 0, 1, 0, 1,
+            1, 0}, {1, 1, 0, 1, 0, 1, 1, 1}, {1, 1, 0, 1, 1, 0, 0, 0}, {1, 1, 0, 1,
+            1, 0, 0, 1}, {1, 1, 0, 1, 1, 0, 1, 0}, {1, 1, 0, 1, 1, 0, 1, 1}, {1, 1,
+            0, 1, 1, 1, 0, 0}, {1, 1, 0, 1, 1, 1, 0, 1}, {1, 1, 0, 1, 1, 1, 1, 0},
+            {1, 1, 0, 1, 1, 1, 1, 1}, {1, 1, 1, 0, 0, 0, 0, 0}, {1, 1, 1, 0, 0, 0,
+            0, 1}, {1, 1, 1, 0, 0, 0, 1, 0}, {1, 1, 1, 0, 0, 0, 1, 1}, {1, 1, 1, 0,
+            0, 1, 0, 0}, {1, 1, 1, 0, 0, 1, 0, 1}, {1, 1, 1, 0, 0, 1, 1, 0}, {1, 1,
+            1, 0, 0, 1, 1, 1}, {1, 1, 1, 0, 1, 0, 0, 0}, {1, 1, 1, 0, 1, 0, 0, 1},
+            {1, 1, 1, 0, 1, 0, 1, 0}, {1, 1, 1, 0, 1, 0, 1, 1}, {1, 1, 1, 0, 1, 1,
+            0, 0}, {1, 1, 1, 0, 1, 1, 0, 1}, {1, 1, 1, 0, 1, 1, 1, 0}, {1, 1, 1, 0,
+            1, 1, 1, 1}, {1, 1, 1, 1, 0, 0, 0, 1}, {1, 1, 1, 1, 0, 0, 1, 0}, {1, 1,
+            1, 1, 0, 0, 1, 1}, {1, 1, 1, 1, 0, 1, 0, 0}, {1, 1, 1, 1, 0, 1, 0, 1},
+            {1, 1, 1, 1, 0, 1, 1, 0}, {1, 1, 1, 1, 0, 1, 1, 1}, {1, 1, 1, 1, 1, 0,
+            0, 0}, {1, 1, 1, 1, 1, 0, 0, 1}, {1, 1, 1, 1, 1, 0, 1, 0}, {1, 1, 1, 1,
+            1, 0, 1, 1}, {1, 1, 1, 1, 1, 1, 0, 0}, {1, 1, 1, 1, 1, 1, 0, 1}, {1, 1,
+            1, 1, 1, 1, 1, 0}};
+
+    public static int[][] V4 = {{0, 0, 0, 0}, {0, 0, 0, 1}, {0, 0, 1, 0}, {0, 0, 1, 1}, {0, 1, 0, 0},
+            {0, 1, 0, 1}, {0, 1, 1, 0}, {0, 1, 1, 1}, {1, 0, 0, 0}, {1, 0, 0, 1},
+            {1, 0, 1, 0}, {1, 0, 1, 1}, {1, 1, 0, 0}, {1, 1, 0, 1}, {1, 1, 1, 0},
+            {1, 1, 1, 1}};
+
+    public static int[][] V8 = {{0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0, 0,
+            1, 0}, {0, 0, 0, 0, 0, 0, 1, 1}, {0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 0,
+            0, 1, 0, 1}, {0, 0, 0, 0, 0, 1, 1, 0}, {0, 0, 0, 0, 0, 1, 1, 1}, {0, 0,
+            0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 1}, {0, 0, 0, 0, 1, 0, 1, 0},
+            {0, 0, 0, 0, 1, 0, 1, 1}, {0, 0, 0, 0, 1, 1, 0, 0}, {0, 0, 0, 0, 1, 1,
+            0, 1}, {0, 0, 0, 0, 1, 1, 1, 0}, {0, 0, 0, 0, 1, 1, 1, 1}, {0, 0, 0, 1,
+            0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 1}, {0, 0, 0, 1, 0, 0, 1, 0}, {0, 0,
+            0, 1, 0, 0, 1, 1}, {0, 0, 0, 1, 0, 1, 0, 0}, {0, 0, 0, 1, 0, 1, 0, 1},
+            {0, 0, 0, 1, 0, 1, 1, 0}, {0, 0, 0, 1, 0, 1, 1, 1}, {0, 0, 0, 1, 1, 0,
+            0, 0}, {0, 0, 0, 1, 1, 0, 0, 1}, {0, 0, 0, 1, 1, 0, 1, 0}, {0, 0, 0, 1,
+            1, 0, 1, 1}, {0, 0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 1, 1, 1, 0, 1}, {0, 0,
+            0, 1, 1, 1, 1, 0}, {0, 0, 0, 1, 1, 1, 1, 1}, {0, 0, 1, 0, 0, 0, 0, 0},
+            {0, 0, 1, 0, 0, 0, 0, 1}, {0, 0, 1, 0, 0, 0, 1, 0}, {0, 0, 1, 0, 0, 0,
+            1, 1}, {0, 0, 1, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 1, 0, 1}, {0, 0, 1, 0,
+            0, 1, 1, 0}, {0, 0, 1, 0, 0, 1, 1, 1}, {0, 0, 1, 0, 1, 0, 0, 0}, {0, 0,
+            1, 0, 1, 0, 0, 1}, {0, 0, 1, 0, 1, 0, 1, 0}, {0, 0, 1, 0, 1, 0, 1, 1},
+            {0, 0, 1, 0, 1, 1, 0, 0}, {0, 0, 1, 0, 1, 1, 0, 1}, {0, 0, 1, 0, 1, 1,
+            1, 0}, {0, 0, 1, 0, 1, 1, 1, 1}, {0, 0, 1, 1, 0, 0, 0, 0}, {0, 0, 1, 1,
+            0, 0, 0, 1}, {0, 0, 1, 1, 0, 0, 1, 0}, {0, 0, 1, 1, 0, 0, 1, 1}, {0, 0,
+            1, 1, 0, 1, 0, 0}, {0, 0, 1, 1, 0, 1, 0, 1}, {0, 0, 1, 1, 0, 1, 1, 0},
+            {0, 0, 1, 1, 0, 1, 1, 1}, {0, 0, 1, 1, 1, 0, 0, 0}, {0, 0, 1, 1, 1, 0,
+            0, 1}, {0, 0, 1, 1, 1, 0, 1, 0}, {0, 0, 1, 1, 1, 0, 1, 1}, {0, 0, 1, 1,
+            1, 1, 0, 0}, {0, 0, 1, 1, 1, 1, 0, 1}, {0, 0, 1, 1, 1, 1, 1, 0}, {0, 0,
+            1, 1, 1, 1, 1, 1}, {0, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 1},
+            {0, 1, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 1, 1}, {0, 1, 0, 0, 0, 1,
+            0, 0}, {0, 1, 0, 0, 0, 1, 0, 1}, {0, 1, 0, 0, 0, 1, 1, 0}, {0, 1, 0, 0,
+            0, 1, 1, 1}, {0, 1, 0, 0, 1, 0, 0, 0}, {0, 1, 0, 0, 1, 0, 0, 1}, {0, 1,
+            0, 0, 1, 0, 1, 0}, {0, 1, 0, 0, 1, 0, 1, 1}, {0, 1, 0, 0, 1, 1, 0, 0},
+            {0, 1, 0, 0, 1, 1, 0, 1}, {0, 1, 0, 0, 1, 1, 1, 0}, {0, 1, 0, 0, 1, 1,
+            1, 1}, {0, 1, 0, 1, 0, 0, 0, 0}, {0, 1, 0, 1, 0, 0, 0, 1}, {0, 1, 0, 1,
+            0, 0, 1, 0}, {0, 1, 0, 1, 0, 0, 1, 1}, {0, 1, 0, 1, 0, 1, 0, 0}, {0, 1,
+            0, 1, 0, 1, 0, 1}, {0, 1, 0, 1, 0, 1, 1, 0}, {0, 1, 0, 1, 0, 1, 1, 1},
+            {0, 1, 0, 1, 1, 0, 0, 0}, {0, 1, 0, 1, 1, 0, 0, 1}, {0, 1, 0, 1, 1, 0,
+            1, 0}, {0, 1, 0, 1, 1, 0, 1, 1}, {0, 1, 0, 1, 1, 1, 0, 0}, {0, 1, 0, 1,
+            1, 1, 0, 1}, {0, 1, 0, 1, 1, 1, 1, 0}, {0, 1, 0, 1, 1, 1, 1, 1}, {0, 1,
+            1, 0, 0, 0, 0, 0}, {0, 1, 1, 0, 0, 0, 0, 1}, {0, 1, 1, 0, 0, 0, 1, 0},
+            {0, 1, 1, 0, 0, 0, 1, 1}, {0, 1, 1, 0, 0, 1, 0, 0}, {0, 1, 1, 0, 0, 1,
+            0, 1}, {0, 1, 1, 0, 0, 1, 1, 0}, {0, 1, 1, 0, 0, 1, 1, 1}, {0, 1, 1, 0,
+            1, 0, 0, 0}, {0, 1, 1, 0, 1, 0, 0, 1}, {0, 1, 1, 0, 1, 0, 1, 0}, {0, 1,
+            1, 0, 1, 0, 1, 1}, {0, 1, 1, 0, 1, 1, 0, 0}, {0, 1, 1, 0, 1, 1, 0, 1},
+            {0, 1, 1, 0, 1, 1, 1, 0}, {0, 1, 1, 0, 1, 1, 1, 1}, {0, 1, 1, 1, 0, 0,
+            0, 0}, {0, 1, 1, 1, 0, 0, 0, 1}, {0, 1, 1, 1, 0, 0, 1, 0}, {0, 1, 1, 1,
+            0, 0, 1, 1}, {0, 1, 1, 1, 0, 1, 0, 0}, {0, 1, 1, 1, 0, 1, 0, 1}, {0, 1,
+            1, 1, 0, 1, 1, 0}, {0, 1, 1, 1, 0, 1, 1, 1}, {0, 1, 1, 1, 1, 0, 0, 0},
+            {0, 1, 1, 1, 1, 0, 0, 1}, {0, 1, 1, 1, 1, 0, 1, 0}, {0, 1, 1, 1, 1, 0,
+            1, 1}, {0, 1, 1, 1, 1, 1, 0, 0}, {0, 1, 1, 1, 1, 1, 0, 1}, {0, 1, 1, 1,
+            1, 1, 1, 0}, {0, 1, 1, 1, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 0, 0}, {1, 0,
+            0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 1, 0}, {1, 0, 0, 0, 0, 0, 1, 1},
+            {1, 0, 0, 0, 0, 1, 0, 0}, {1, 0, 0, 0, 0, 1, 0, 1}, {1, 0, 0, 0, 0, 1,
+            1, 0}, {1, 0, 0, 0, 0, 1, 1, 1}, {1, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0,
+            1, 0, 0, 1}, {1, 0, 0, 0, 1, 0, 1, 0}, {1, 0, 0, 0, 1, 0, 1, 1}, {1, 0,
+            0, 0, 1, 1, 0, 0}, {1, 0, 0, 0, 1, 1, 0, 1}, {1, 0, 0, 0, 1, 1, 1, 0},
+            {1, 0, 0, 0, 1, 1, 1, 1}, {1, 0, 0, 1, 0, 0, 0, 0}, {1, 0, 0, 1, 0, 0,
+            0, 1}, {1, 0, 0, 1, 0, 0, 1, 0}, {1, 0, 0, 1, 0, 0, 1, 1}, {1, 0, 0, 1,
+            0, 1, 0, 0}, {1, 0, 0, 1, 0, 1, 0, 1}, {1, 0, 0, 1, 0, 1, 1, 0}, {1, 0,
+            0, 1, 0, 1, 1, 1}, {1, 0, 0, 1, 1, 0, 0, 0}, {1, 0, 0, 1, 1, 0, 0, 1},
+            {1, 0, 0, 1, 1, 0, 1, 0}, {1, 0, 0, 1, 1, 0, 1, 1}, {1, 0, 0, 1, 1, 1,
+            0, 0}, {1, 0, 0, 1, 1, 1, 0, 1}, {1, 0, 0, 1, 1, 1, 1, 0}, {1, 0, 0, 1,
+            1, 1, 1, 1}, {1, 0, 1, 0, 0, 0, 0, 0}, {1, 0, 1, 0, 0, 0, 0, 1}, {1, 0,
+            1, 0, 0, 0, 1, 0}, {1, 0, 1, 0, 0, 0, 1, 1}, {1, 0, 1, 0, 0, 1, 0, 0},
+            {1, 0, 1, 0, 0, 1, 0, 1}, {1, 0, 1, 0, 0, 1, 1, 0}, {1, 0, 1, 0, 0, 1,
+            1, 1}, {1, 0, 1, 0, 1, 0, 0, 0}, {1, 0, 1, 0, 1, 0, 0, 1}, {1, 0, 1, 0,
+            1, 0, 1, 0}, {1, 0, 1, 0, 1, 0, 1, 1}, {1, 0, 1, 0, 1, 1, 0, 0}, {1, 0,
+            1, 0, 1, 1, 0, 1}, {1, 0, 1, 0, 1, 1, 1, 0}, {1, 0, 1, 0, 1, 1, 1, 1},
+            {1, 0, 1, 1, 0, 0, 0, 0}, {1, 0, 1, 1, 0, 0, 0, 1}, {1, 0, 1, 1, 0, 0,
+            1, 0}, {1, 0, 1, 1, 0, 0, 1, 1}, {1, 0, 1, 1, 0, 1, 0, 0}, {1, 0, 1, 1,
+            0, 1, 0, 1}, {1, 0, 1, 1, 0, 1, 1, 0}, {1, 0, 1, 1, 0, 1, 1, 1}, {1, 0,
+            1, 1, 1, 0, 0, 0}, {1, 0, 1, 1, 1, 0, 0, 1}, {1, 0, 1, 1, 1, 0, 1, 0},
+            {1, 0, 1, 1, 1, 0, 1, 1}, {1, 0, 1, 1, 1, 1, 0, 0}, {1, 0, 1, 1, 1, 1,
+            0, 1}, {1, 0, 1, 1, 1, 1, 1, 0}, {1, 0, 1, 1, 1, 1, 1, 1}, {1, 1, 0, 0,
+            0, 0, 0, 0}, {1, 1, 0, 0, 0, 0, 0, 1}, {1, 1, 0, 0, 0, 0, 1, 0}, {1, 1,
+            0, 0, 0, 0, 1, 1}, {1, 1, 0, 0, 0, 1, 0, 0}, {1, 1, 0, 0, 0, 1, 0, 1},
+            {1, 1, 0, 0, 0, 1, 1, 0}, {1, 1, 0, 0, 0, 1, 1, 1}, {1, 1, 0, 0, 1, 0,
+            0, 0}, {1, 1, 0, 0, 1, 0, 0, 1}, {1, 1, 0, 0, 1, 0, 1, 0}, {1, 1, 0, 0,
+            1, 0, 1, 1}, {1, 1, 0, 0, 1, 1, 0, 0}, {1, 1, 0, 0, 1, 1, 0, 1}, {1, 1,
+            0, 0, 1, 1, 1, 0}, {1, 1, 0, 0, 1, 1, 1, 1}, {1, 1, 0, 1, 0, 0, 0, 0},
+            {1, 1, 0, 1, 0, 0, 0, 1}, {1, 1, 0, 1, 0, 0, 1, 0}, {1, 1, 0, 1, 0, 0,
+            1, 1}, {1, 1, 0, 1, 0, 1, 0, 0}, {1, 1, 0, 1, 0, 1, 0, 1}, {1, 1, 0, 1,
+            0, 1, 1, 0}, {1, 1, 0, 1, 0, 1, 1, 1}, {1, 1, 0, 1, 1, 0, 0, 0}, {1, 1,
+            0, 1, 1, 0, 0, 1}, {1, 1, 0, 1, 1, 0, 1, 0}, {1, 1, 0, 1, 1, 0, 1, 1},
+            {1, 1, 0, 1, 1, 1, 0, 0}, {1, 1, 0, 1, 1, 1, 0, 1}, {1, 1, 0, 1, 1, 1,
+            1, 0}, {1, 1, 0, 1, 1, 1, 1, 1}, {1, 1, 1, 0, 0, 0, 0, 0}, {1, 1, 1, 0,
+            0, 0, 0, 1}, {1, 1, 1, 0, 0, 0, 1, 0}, {1, 1, 1, 0, 0, 0, 1, 1}, {1, 1,
+            1, 0, 0, 1, 0, 0}, {1, 1, 1, 0, 0, 1, 0, 1}, {1, 1, 1, 0, 0, 1, 1, 0},
+            {1, 1, 1, 0, 0, 1, 1, 1}, {1, 1, 1, 0, 1, 0, 0, 0}, {1, 1, 1, 0, 1, 0,
+            0, 1}, {1, 1, 1, 0, 1, 0, 1, 0}, {1, 1, 1, 0, 1, 0, 1, 1}, {1, 1, 1, 0,
+            1, 1, 0, 0}, {1, 1, 1, 0, 1, 1, 0, 1}, {1, 1, 1, 0, 1, 1, 1, 0}, {1, 1,
+            1, 0, 1, 1, 1, 1}, {1, 1, 1, 1, 0, 0, 0, 0}, {1, 1, 1, 1, 0, 0, 0, 1},
+            {1, 1, 1, 1, 0, 0, 1, 0}, {1, 1, 1, 1, 0, 0, 1, 1}, {1, 1, 1, 1, 0, 1,
+            0, 0}, {1, 1, 1, 1, 0, 1, 0, 1}, {1, 1, 1, 1, 0, 1, 1, 0}, {1, 1, 1, 1,
+            0, 1, 1, 1}, {1, 1, 1, 1, 1, 0, 0, 0}, {1, 1, 1, 1, 1, 0, 0, 1}, {1, 1,
+            1, 1, 1, 0, 1, 0}, {1, 1, 1, 1, 1, 0, 1, 1}, {1, 1, 1, 1, 1, 1, 0, 0},
+            {1, 1, 1, 1, 1, 1, 0, 1}, {1, 1, 1, 1, 1, 1, 1, 0}, {1, 1, 1, 1, 1, 1,
+            1, 1}};
+
+    public static int[][] G = {{1, 1, 1, 1, 1, 1, 1, 1},
+            {0, 1, 0, 1, 0, 1, 0, 1},
+            {0, 0, 1, 1, 0, 0, 1, 1},
+            {0, 0, 0, 0, 1, 1, 1, 1}};
+
+    public static int i,s;
+
+    //static Set<Integer> Xset = new HashSet<Integer>();
+
+
+    static int[] X1 =new int[4];
+    static int[] alpha1 =new int[8];
+    static int[] Y1 =new int[8];
+    static int[] Y2 =new int[8];
+    static int[] Y3 =new int[8];
+    static int[] Y4 =new int[8];
+//    static int[] Y5 =new int[8];
+//    static int[] Y6 =new int[8];
+
+    static int[] S0;
+
+    SecretShare(int n)
+    {
+        s=n;
+    }
+
+    public static int generaterandom(int length)
+    {
+        int r = new Random().nextInt(length);
+        return r;
+    }
+
+
+
+    public static int[] genarray(int arr[][],int size)// To get random elements from any arrays
+    {
+        int j;
+        int[] temp = new int[size];
+        int r = generaterandom(arr.length);
+        for (j = 0; j < size; j++) {
+            temp[j] = arr[r][j];
+        }
+
+        return temp;
+    }
+
+
+
+    public static int[] multiplyMatrices(int[] firstMatrix, int[][] secondMatrix,int c1, int c2)
+    {
+        int[] product = new int[c2];
+        int i,j,sums=0;
+        for(i=0;i<c2;i++)
+        {
+            for(j=0;j<c1;j++)
+            {
+                sums+=secondMatrix[j][i]*firstMatrix[j];
+            }
+            product[i]=sums;
+            sums=0;
+        }
+
+        return product;
+    }
+
+
+    public static int[] checkcomply(int[] cand, int[] S0)
+    {
+        int sum=5;  //can be any number greater than 's', so that we can enter the while loop
+        while(sum>s)
+        {
+            sum = 0;
+            for (i = 0; i < cand.length; i++)
+                sum = sum + (cand[i] * S0[i]);
+            sum=sum%2;
+            if (sum != s)           //if not valid
+            {
+                cand = genarray(V8, 8); //get new Y
+                cand = checkcomply(cand, S0); //check new Y
+            }
+        }
+        return cand;
+
+    }
+
+
+    public void starts()
+    {
+
+        X1 = genarray(V4,4);
+        alpha1 = genarray(LA,8);
+
+        Y1 = genarray(V8,8);
+        Y2 = genarray(V8,8);
+        Y3 = genarray(V8,8);
+        Y4 = genarray(V8,8);
+//        Y5 = genarray(V8,8);
+//        Y6 = genarray(V8,8);
+        int[] tempmat;
+        tempmat = multiplyMatrices(X1,G,4,8);
+
+        S0 = new int[tempmat.length];
+
+        for(i=0;i<alpha1.length;i++)
+            S0[i]=(tempmat[i]+alpha1[i])%2;
+
+        Y1 = checkcomply(Y1,S0);
+        Y2 = checkcomply(Y2,S0);
+        Y3 = checkcomply(Y2,S0);
+        Y4 = checkcomply(Y2,S0);
+//        Y5 = checkcomply(Y2,S0);
+//        Y6 = checkcomply(Y2,S0);
+
+
+    }
+}
+
+
+
+
+
diff --git a/src/main/java/com/rubix/WAMPAC/NMS/Recovery/RecoveryAssistQuorum.java b/src/main/java/com/rubix/WAMPAC/NMS/Recovery/RecoveryAssistQuorum.java
new file mode 100644
index 0000000000000000000000000000000000000000..1c07c5029cdfa31b99317ddcc78f17b9a6167e56
--- /dev/null
+++ b/src/main/java/com/rubix/WAMPAC/NMS/Recovery/RecoveryAssistQuorum.java
@@ -0,0 +1,117 @@
+package com.rubix.WAMPAC.NMS.Recovery;
+
+import com.rubix.Resources.Functions;
+import com.rubix.Resources.IPFSNetwork;
+import io.ipfs.api.IPFS;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.net.BindException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+
+import static com.rubix.Resources.Functions.*;
+import static com.rubix.WAMPAC.NMS.Constants.PathConstants.nmsFolder;
+
+public class RecoveryAssistQuorum implements Runnable {
+    static int PORT = 15050;
+    public static Logger RecoveryAssistQuorum = Logger.getLogger(RecoveryAssistQuorum.class);
+
+    @Override
+    public void run() {
+        while (true){
+            PropertyConfigurator.configure(Functions.LOGGER_PATH + "log4jWallet.properties");
+            String shareIPFS = null;
+            ServerSocket serverSocket = null;
+            Socket socket = null;
+            BufferedReader in = null;
+            PrintStream out= null;
+            Boolean flag = false;
+
+
+
+            try {
+                RecoveryAssistQuorum.debug("Quorum Listening on " + PORT);
+                serverSocket = new ServerSocket(PORT);
+                socket = serverSocket.accept();
+                System.out.println("Accepted");
+                in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+                out = new PrintStream(socket.getOutputStream());
+                String json = in.readLine();
+                JSONObject temp = new JSONObject(json);
+                String tid = temp.getString("tid");
+                String log = readFile(nmsFolder + temp.getString("did") + "\\log.json");
+                JSONArray records = new JSONArray(log);
+                for (int i = (records.length()-1); i >= 0; i--) {
+                    JSONObject record = records.getJSONObject(i);
+                    if(record.getString("tid").equals(tid)){
+                        shareIPFS = record.getString("share");
+                        flag = true;
+                        break;
+                    }
+                }
+                if(flag){
+                    IPFS ipfs = new IPFS("/ip4/127.0.0.1/tcp/" + IPFS_PORT);
+                    String share = IPFSNetwork.get(shareIPFS,ipfs);
+                    out.println(share);
+                }else
+                    out.println("Not_Found");
+
+                in.close();
+                out.close();
+                socket.close();
+                serverSocket.close();
+
+            }
+            catch (BindException e)
+            {
+                try {
+                    in.close();
+                    out.close();
+                    socket.close();
+                    serverSocket.close();
+                    e.printStackTrace();
+                } catch (IOException ioException) {
+                    ioException.printStackTrace();
+                }
+            }
+            catch (IOException e) {
+                try {
+                    in.close();
+                    out.close();
+                    socket.close();
+                    serverSocket.close();
+                    e.printStackTrace();
+                } catch (IOException ioException) {
+                    ioException.printStackTrace();
+                }
+
+            } catch (JSONException e) {
+                try {
+                    in.close();
+                    out.close();
+                    socket.close();
+                    serverSocket.close();
+                } catch (IOException ioException) {
+                    ioException.printStackTrace();
+                }
+                e.printStackTrace();
+            }
+
+        }
+    }
+
+//    public static void main(String[] args) {
+//        pathSet();
+//        RecoveryAssistQuorum q1 = new RecoveryAssistQuorum();
+//        q1.run();
+//    }
+}
diff --git a/src/main/java/com/rubix/WAMPAC/NMS/Recovery/RecoveryInit.java b/src/main/java/com/rubix/WAMPAC/NMS/Recovery/RecoveryInit.java
new file mode 100644
index 0000000000000000000000000000000000000000..3fbded81ccebef6bece80db5f4b3a00b0424d7e3
--- /dev/null
+++ b/src/main/java/com/rubix/WAMPAC/NMS/Recovery/RecoveryInit.java
@@ -0,0 +1,105 @@
+package com.rubix.WAMPAC.NMS.Recovery;
+
+
+import com.rubix.Resources.Functions;
+import com.rubix.WAMPAC.NMS.NLSS.Interact;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.*;
+import java.net.Socket;
+import java.util.Iterator;
+
+import static com.rubix.Resources.Functions.readFile;
+import static com.rubix.Resources.Functions.writeToFile;
+import static com.rubix.WAMPAC.NMS.Constants.PathConstants.RecoveryFolder;
+import static com.rubix.WAMPAC.NMS.Constants.PathConstants.nmsFolder;
+
+
+public class RecoveryInit {
+    static int PORT = 15050;
+    public static Logger RecoveryInitLogger = Logger.getLogger(RecoveryInit.class);
+
+    public static void Recover(String did) throws JSONException {
+        PropertyConfigurator.configure(Functions.LOGGER_PATH + "log4jWallet.properties");
+        JSONArray records = new JSONArray(readFile(nmsFolder+"log.json"));
+        JSONArray shares = new JSONArray();
+        JSONArray quorum = null;
+        String tid = null;
+        for (int i = records.length()-1; i >= 0 ; i--) {
+            if(records.getJSONObject(i).getString("status").equals("backup")){
+                quorum = records.getJSONObject(i).getJSONArray("quorumiplist");
+                tid = records.getJSONObject(i).getString("tid");
+                break;
+            }
+        }
+
+        Socket socket;
+        try {
+            socket = new Socket(quorum.getString(0), PORT);
+            BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+            PrintStream out = new PrintStream(socket.getOutputStream());
+            JSONObject details = new JSONObject();
+            details.put("tid",tid);
+            details.put("did",did);
+            out.println(details);
+            String essentialResponse = in.readLine();
+            if(essentialResponse!=null || !essentialResponse.equals("Not_Found")) {
+                JSONObject temp = new JSONObject(essentialResponse);
+                shares.put(temp);
+
+                in.close();
+                out.close();
+                socket.close();
+
+
+                for (int i = 1; i < quorum.length() && shares.length()<2; i++) {
+                    socket = new Socket(quorum.getString(i), PORT);
+                    in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+                    out = new PrintStream(socket.getOutputStream());
+                    out.println(details);
+                    String response = in.readLine();
+                    if(response!=null || !response.equals("Not_Found")) {
+                        temp = new JSONObject(response);
+                        shares.put(temp);
+                    }
+                    in.close();
+                    out.close();
+                    socket.close();
+                }
+
+                JSONObject essential = shares.getJSONObject(0);
+                JSONObject cand1 = shares.getJSONObject(1);
+//                JSONObject cand2 = shares.getJSONObject(2);
+
+                Iterator<String> keys = essential.keys();
+
+                while(keys.hasNext()) {
+                    String key = keys.next();
+//                    File recovered = new File(nmsFolder+"Recovered");RecoveryFolder
+                    File recovered = new File(RecoveryFolder);
+                    if(!recovered.exists())
+                        recovered.mkdirs();
+                    writeToFile(RecoveryFolder + key, Interact.getback(essential.getString(key),cand1.getString(key)),false);
+                }
+                RecoveryInitLogger.debug("Recovery Successful");
+            }
+            else{
+                // disconnect
+                RecoveryInitLogger.error("Could not fetch essential share");
+                in.close();
+                out.close();
+                socket.close();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+
+
+
+    }
+}
diff --git a/src/main/java/com/rubix/WAMPAC/NMS/Resources/Functions.java b/src/main/java/com/rubix/WAMPAC/NMS/Resources/Functions.java
new file mode 100644
index 0000000000000000000000000000000000000000..c178f7f03d84b969eb6346b9725e54f259b16e62
--- /dev/null
+++ b/src/main/java/com/rubix/WAMPAC/NMS/Resources/Functions.java
@@ -0,0 +1,73 @@
+package com.rubix.WAMPAC.NMS.Resources;
+
+import com.profesorfalken.jpowershell.PowerShell;
+import com.profesorfalken.jpowershell.PowerShellResponse;
+import io.ipfs.api.MerkleNode;
+import io.ipfs.api.NamedStreamable;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+
+import static com.rubix.Resources.APIHandler.ipfs;
+import static com.rubix.Resources.Functions.DATA_PATH;
+import static com.rubix.Resources.Functions.readFile;
+import static com.rubix.WAMPAC.NMS.Constants.PathConstants.logsFolder;
+
+public class Functions {
+
+    public static void populateLogs(){
+        PowerShellResponse response = PowerShell.executeSingleCommand("Get-WinEvent -FilterHashTable @{logname='system'; starttime=(Get-Date) - (New-TimeSpan -Hours 6)} | Select TimeCreated,Id,LevelDisplayName | Export-Csv -Path "+logsFolder+"system.csv -NoTypeInformation");
+        response = PowerShell.executeSingleCommand("Get-WinEvent -FilterHashTable @{logname='Application'; starttime=(Get-Date) - (New-TimeSpan -Hours 6)} | Select TimeCreated,Id,LevelDisplayName | Export-Csv -Path "+logsFolder+"Application.csv -NoTypeInformation");
+        response = PowerShell.executeSingleCommand("Get-WinEvent -FilterHashTable @{logname='Security'; starttime=(Get-Date) - (New-TimeSpan -Hours 6)} | Select TimeCreated,Id,LevelDisplayName | Export-Csv -Path "+logsFolder+"Security.csv -NoTypeInformation");
+//        response = PowerShell.executeSingleCommand("Get-WinEvent -FilterHashTable @{logname='Microsoft-Windows-NetworkProfile%4Operational'; level=1,2,3; starttime=(Get-Date) - (New-TimeSpan -Hours 24)} | Select TimeCreated,Id,LevelDisplayName | Export-Csv -Path "+logsFolder+"\\Microsoft-Windows-NetworkProfile%4Operational.csv -NoTypeInformation");
+    }
+
+    public static List<MerkleNode> addFolder(String folder){
+        List<NamedStreamable> file = new NamedStreamable.FileWrapper(new File(folder)).getChildren();
+        try {
+            List<MerkleNode> response = ipfs.add(file, true, true);
+            return response;
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public static String convertToBinary(String strs){
+        strs=strs.replaceAll("\\s+","");
+        byte[] bytes = strs.getBytes();
+        StringBuilder binary = new StringBuilder();
+        for (byte b : bytes){
+            int val = b;
+            for (int i = 0; i < 8; i++){
+                binary.append((val & 128) == 0 ? 0 : 1);
+                val <<= 1;
+            }
+            binary.append(' ');
+        }
+        return binary.toString();
+    }
+
+    public static JSONArray getVerifierIPList() throws JSONException {
+        JSONObject temp;
+        JSONArray ip = new JSONArray();
+        File file = new File(DATA_PATH+"vip.json");
+        if(file.exists()) {
+            JSONArray verifiers = new JSONArray(readFile(DATA_PATH + "vip.json"));
+            for (int i = 0; i < verifiers.length(); i++) {
+                temp = verifiers.getJSONObject(i);
+                if (temp.getString("role").equals("Verifier")) {
+                    ip.put(temp.getString("ip"));
+                }
+            }
+            return ip;
+        }
+        else return new JSONArray();
+    }
+
+}
diff --git a/src/main/java/com/rubix/WAMPAC/NMS/logAnalysis/Analyze.java b/src/main/java/com/rubix/WAMPAC/NMS/logAnalysis/Analyze.java
new file mode 100644
index 0000000000000000000000000000000000000000..f77b82242ca73d622ad42ca8147996588f0f196a
--- /dev/null
+++ b/src/main/java/com/rubix/WAMPAC/NMS/logAnalysis/Analyze.java
@@ -0,0 +1,105 @@
+package com.rubix.WAMPAC.NMS.logAnalysis;
+
+import com.opencsv.CSVReader;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.Reader;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import static com.rubix.Resources.Functions.readFile;
+import static com.rubix.WAMPAC.NMS.Constants.PathConstants.nmsFolder;
+
+public class Analyze {
+    static int error_count=0,warning_count=0,info_rules_count_login =0,info_rules_count_others=0;
+    static boolean status=false;
+    static Date dateparser(String dateval) throws ParseException {
+        String[] values = dateval.split(" ");
+        SimpleDateFormat format = new SimpleDateFormat("hh:mm:ss a");
+        Date date = format.parse(values[1]+" "+values[2]);
+        return date;
+    }
+    static boolean smackdownAnalyze(String[] column) throws ParseException, JSONException {
+        JSONObject rules = new JSONObject(readFile(nmsFolder+"rules.json"));
+
+        String start_date_string = rules.getString("start_date");
+        String end_date_string = rules.getString("end_date");
+        DateFormat formatter = new SimpleDateFormat("hh:mm:ss a");
+        Date start_date = formatter.parse(start_date_string);
+        Date end_date=formatter.parse(end_date_string);
+        Date parse_date = null;
+        switch (column[2]) {
+            case "Critical":
+                status=true;
+                break;
+            case "Error":
+                if (column[1].equals("521"))
+                    status=true;
+                else
+                error_count+=1;
+                if(error_count>rules.getInt("error_threshold"))
+                    status=true;
+                break;
+            case "Warning":
+                warning_count+=1;
+                if(warning_count>rules.getInt("warning_threshold"))
+                    status=true;
+                break;
+            default:
+               switch (column[1]) {
+                   case "4624":
+                   case "4625":
+                   case "4648":
+                   case "4720":
+                   case "4722":
+                   case "4725":
+                   case "4726":
+                   case "1102":
+                           parse_date = dateparser(column[0]);
+                       if (!(parse_date.after(start_date) && parse_date.before(end_date)))
+                           status = true;
+                       break;
+                   case "4606":
+                       info_rules_count_others+=1;
+                       if(info_rules_count_others>rules.getInt("info_others_threshold"))
+                           status=true;
+                       break;
+                   default: break;
+               }
+               break;
+        }
+        return status;
+    }
+    public static boolean rawAnalyze(String did) {
+        File logfile = new File(nmsFolder+did+"\\log.json");
+        if(!logfile.exists())
+            return false;
+        int i=0;
+        String[] csv_files = {nmsFolder+did+"\\system.csv",nmsFolder+did+"\\security.csv", nmsFolder+did+"\\application.csv"};
+        while ((i < csv_files.length && status==false))
+        {
+            try {
+                Reader reader = new FileReader(csv_files[i]);
+                List<String[]> rows = new CSVReader(reader).readAll();
+                if(!rows.isEmpty())
+                    rows.remove(0);
+                for (String[] column : rows) {
+                    if(smackdownAnalyze(column)) {
+                        break;
+                    }
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            i++;
+        }
+        System.out.println(status);
+        return status;
+    }
+}