diff --git a/gen/gateway.yaml b/gen/gateway.yaml
index 0001165edd70efba65c1eef115eb9d5e245705f6..d42fb03673b16c6a08c7a20e9961248a204d05ec 100644
--- a/gen/gateway.yaml
+++ b/gen/gateway.yaml
@@ -1,3 +1,4 @@
+# START YAML ===
 ################################################################################
 ## Copyright © 2018 Privategrity Corporation                                   #
 ##                                                                             #
@@ -12,19 +13,21 @@
 loglevel: 2
 
 # Output log file
-log: "gateway-1.log"
+log: "results/gateways/gateway-1.log"
+
+# The public IP address and port of the node associated with this gateway
+cmixAddress: {NODE_ADDR}
 
 # The listening port of this gateway
 Port: {GW_ADDR}
 
-# The local IP address of the Gateway used for internal listening.
-localAddress: "0.0.0.0"
-
-# The public IP address of the Node associated with this Gateway.
-nodeAddress: {NODE_ADDR}
+# The public IPv4 address of the Gateway, as reported to the network, to use
+# instead of dynamically looking up Gateway's own IP address. If a port is not
+# included, then the port flag is used instead.
+overridePublicIP: "0.0.0.0"
 
 # Period in which the message cleanup function executes. Recommended period is on the order of a minute.
-messageTimeout: "60s"
+messageTimeout: "1800s"
 
 # Path to where the IDF is saved. This is used by the wrapper management script.
 idfPath: "results/gateways/gatewayIDF-0.json"
@@ -40,7 +43,7 @@ schedulingCertPath: "../keys/cmix.rip.crt"
 cmixCertPath: "../keys/cmix.rip.crt"
 
 
+devMode: true
 
-# Needed to verify that NDF originated from permissioning
-# Path to the permissioning certificate file
-permissioningCertPath: "configurations/keys/permissioning.crt"
+minRegisteredNodes: 0
+# === END YAML
diff --git a/gen/network.config b/gen/network.config
index e7242113823cac0bea1eec70d766f3c66acbdf0a..fb698ebc71bb4b3d61c25ea658ec8e5554735534 100644
--- a/gen/network.config
+++ b/gen/network.config
@@ -1,4 +1,4 @@
-localhost:8440
+localhost:{entry_point}
 # This is the network configuration file. The top line of this file,
 # when not set via command line, is used to determine to which network
 # the integration test will be run against.
diff --git a/gen/network.sh b/gen/network.sh
deleted file mode 100755
index 372f9000697a41f91e4e9d9839c434145377f242..0000000000000000000000000000000000000000
--- a/gen/network.sh
+++ /dev/null
@@ -1,114 +0,0 @@
-# This script is used to start a basic 5 node network for running clients on. It is meant to be `source`'d into a script
-# which will run clients on the network, such as `client-session-tests.sh` or the main `run.sh`. 
-# 
-# You **must** source it, because otherwise the `trap finish EXIT` instruction will cause the network to stop when 
-# network.sh returns to your script or shell. Sourcing it will "import" the commands into your script instead, causing 
-# the trap instruction to stop the network when your script/shell exits.
-
-echo "STARTING SERVERS..."
-
-SERVERCONFIG=servers/
-SERVERLOGS=results/servers
-GATEWAYLOGS=results/gateways
-UDBOUT=results/udb-console.txt
-
-# Copy udbContact into place when running locally.
-cp udbContact.bin results/udbContact.bin
-
-PERMCMD="../bin/permissioning --logLevel $DEBUGLEVEL -c permissioning.yaml "
-$PERMCMD > results/permissioning-console.txt 2>&1 &
-PIDVAL=$!
-echo "$PERMCMD -- $PIDVAL"
-
-
-# Run Client Registrar
-CLIENT_REG_CMD="../bin/client-registrar \
--l 2 -c client-registrar.yaml"
-$CLIENT_REG_CMD > results/client-registrat-console.txt 2>&1 &
-PIDVAL=$!
-echo "$CLIENT_REG_CMD -- $PIDVAL"
-
-for SERVERID in $(seq 5 -1 1)
-do
-    IDX=$(($SERVERID - 1))
-    SERVERCMD="../bin/server --logLevel $DEBUGLEVEL --config $SERVERCONFIG/server-$SERVERID.yaml"
-    if [ $SERVERID -eq 5 ] && [ -n "$NSYSENABLED" ]
-    then
-        SERVERCMD="nsys profile --session-new=gputest --trace=cuda -o server-$SERVERID $SERVERCMD"
-    fi
-    $SERVERCMD > $SERVERLOGS/server-$SERVERID-console.txt 2>&1 &
-    PIDVAL=$!
-    echo "$SERVERCMD -- $PIDVAL"
-done
-
-# Start gateways
-for GWID in $(seq 5 -1 1)
-do
-    IDX=$(($GWID - 1))
-    GATEWAYCMD="../bin/gateway --logLevel $DEBUGLEVEL --config gateway-$GWID.yaml"
-    $GATEWAYCMD > $GATEWAYLOGS/gateway-$GWID-console.txt 2>&1 &
-    PIDVAL=$!
-    echo "$GATEWAYCMD -- $PIDVAL"
-done
-
-jobs -p > results/serverpids
-
-finish() {
-    echo "STOPPING SERVERS AND GATEWAYS..."
-    if [ -n "$NSYSENABLED" ]
-    then
-        nsys stop --session=gputest
-    fi
-    # NOTE: jobs -p doesn't work in a signal handler
-    for job in $(cat results/serverpids)
-    do
-        echo "KILLING $job"
-        kill $job || true
-    done
-
-    sleep 5
-
-    for job in $(cat results/serverpids)
-    do
-        echo "KILL -9 $job"
-        kill -9 $job || true
-    done
-    #tail $SERVERLOGS/*
-    #tail $CLIENTCLEAN/*
-    #diff -aruN clients.goldoutput $CLIENTCLEAN
-}
-
-trap finish EXIT
-trap finish INT
-
-# Sleeps can die in a fire on the sun, we wait for the servers to start running
-# rounds
-rm rid.txt || true
-touch rid.txt
-cnt=0
-echo -n "Waiting for a round to run"
-while [ ! -s rid.txt ] && [ $cnt -lt 120 ]; do
-    sleep 1
-    grep -a "RID 1 ReceiveFinishRealtime END" results/servers/server-* > rid.txt || true
-    cnt=$(($cnt + 1))
-    echo -n "."
-done
-
-# Start a user discovery bot server
-echo "STARTING UDB..."
-UDBCMD="../bin/udb --logLevel $DEBUGLEVEL --skipVerification --protoUserPath	udbProto.json --config udb.yaml -l 1"
-$UDBCMD >> $UDBOUT 2>&1 &
-PIDVAL=$!
-echo $PIDVAL >> results/serverpids
-echo "$UDBCMD -- $PIDVAL"
-rm rid.txt || true
-while [ ! -s rid.txt ] && [ $cnt -lt 30 ]; do
-    sleep 1
-    grep -a "Sending Poll message" results/udb-console.txt > rid.txt || true
-    cnt=$(($cnt + 1))
-    echo -n "."
-done
-
-echo "localhost:8440" > results/startgwserver.txt
-
-echo "DONE LETS DO STUFF"
\ No newline at end of file
diff --git a/gen/permissioning.yaml b/gen/permissioning.yaml
index 01cc7fb4d9f225edc4e2153d0eaf4bcdb5db6a0b..f2d9b2e21885e69d1f6acd2fa0dc6808441141a3 100644
--- a/gen/permissioning.yaml
+++ b/gen/permissioning.yaml
@@ -4,84 +4,93 @@
 
 # Log message level
 loglevel: 2
+
 # Path to log file
-logPath: "registration.log"
-# Path to the node topology permissioning info
-ndfOutputPath: "ndf.json"
-# Minimum number of nodes to begin running rounds. this differs from the number of members
-# in a team because some scheduling algorithms may require multiple teams worth of nodes at minimum
+logPath: "results/permissioning.log"
+
+# The listening port of this  server
+port: {permissioning_port}
+
+# Database connection information
+dbUsername: ""
+dbPassword: ""
+dbName: ""
+dbAddress: "0.0.0.0:6969"
+
 minimumNodes: 5
 
-# Path to the file containing the round ID
-roundIdPath: "roundId.txt"
+minGatewayVersion: "3.0.0"
+minServerVersion:  "3.0.0"
+minClientVersion: "4.0.0"
+nodeMetricInterval: 3
 
-# Path to the file containing the update ID
-updateIdPath: "updateId.txt"
+# For testing, use the sequence as the country code. Do not use the geobinning database
+disableGeoBinning: true
 
-# UDB ID
-udbID: 1
+# For testing, do not exclude node or gateway IPs which are local to the machine
+allowLocalIPs: true
 
-# Public address, used in NDF it gives to client
-publicAdress: "0.0.0.0:11420"
+# Disable pruning of NDF for offline nodes
+# if set to false, network will sleep for five minutes on start
+disableNDFPruning: true
+permissiveIPChecking: true
 
-# The listening port of this  server
-port: 11420
+# How long rounds will be tracked by gateways. Rounds (and messages as an extension)
+# prior to this period are not guaranteed to be delivered to clients.
+# Expects duration in"h". (Defaults to 1 weeks (168 hours)
+messageRetentionLimit: "168h"
 
-# The minimum version required of gateways to connect
-minGatewayVersion: "1.1.0"
+# Path to the file containing the round ID
+roundIdPath: "results/roundId.txt"
 
-# The minimum version required of servers to connect
-minServerVersion:  "1.1.0"
+# Path to the file containing the update ID
+updateIdPath: "results/updateId.txt"
 
-# Database connection information
-dbUsername: "cmix"
-dbPassword: ""
-dbName: "cmix_server"
-dbAddress: "0.0.0.0:5959"
 
-# Path to JSON file with list of Node registration codes (in order of network 
-# placement)
-RegCodesFilePath: "configurations/regCodes.json"
+# Public address used in NDF to give to client
+registrationAddress: "0.0.0.0:{registration_port}"
+
+# Path to whitelisted IPs for client ratelimiting
+whitelistedIpAddressesPath: "whitelist.txt"
+
+# Path to the node topology permissioning info
+ndfOutputPath: "ndf.json"
+
+# === REQUIRED FOR ENABLING TLS ===
+# Path to the registration server private key file
+keyPath: "../keys/cmix.rip.key"
+# Path to the registration server certificate file
+certPath: "../keys/cmix.rip.crt"
 
-# List of client codes to be added to the database (for testing)
-clientRegCodes:
-  - "AAAA"
-  - "BBBB"
-  - "CCCC"
-    
+fullNdfOutputPath: "results/permissions-ndfoutput.json"
+signedPartialNDFOutputPath: "results/permissions-ndfoutput-partial.json"
 
-# Time interval (in seconds) between committing Node statistics to storage
-nodeMetricInterval: 180
+# === REQUIRED FOR ENABLING TLS ===
+# Path to the UDB certificate file
+udbCertPath: "../keys/cmix.rip.crt"
+# "Location of the user discovery contact file.
+udContactPath: "results/udbContact.bin"
+udbAddress: "127.0.0.1:{udb_port}"
 
 # Time interval (in minutes) in which the database is
 # checked for banned nodes
 BanTrackerInterval: "3"
 
-# === REQUIRED FOR ENABLING TLS ===
-# Path to the permissioning server private key file
-keyPath: "configurations/keys/permissioning.key"
-# Path to the permissioning server certificate file
-certPath: "configurations/keys/permissioning.crt"
-
-# E2E/CMIX Primes
 groups:
   cmix:
-    prime: "F6FAC7E480EE519354C058BF856AEBDC43AD60141BAD5573910476D030A869979A7E23F5FC006B6CE1B1D7CDA849BDE46A145F80EE97C21AA2154FA3A5CF25C75E225C6F3384D3C0C6BEF5061B87E8D583BEFDF790ECD351F6D2B645E26904DE3F8A9861CC3EAD0AA40BD7C09C1F5F655A9E7BA7986B92B73FD9A6A69F54EFC92AC7E21D15C9B85A76084D1EEFBC4781B91E231E9CE5F007BC75A8656CBD98E282671C08A5400C4E4D039DE5FD63AA89A618C5668256B12672C66082F0348B6204DD0ADE58532C967D055A5D2C34C43DF9998820B5DFC4C49C6820191CB3EC81062AA51E23CEEA9A37AB523B24C0E93B440FDC17A50B219AB0D373014C25EE8F"
-    generator: "B22FDF91EE6BA01BDE4969C1A986EA1F81C4A1795921403F3437D681D05E95167C2F6414CCB74AC8D6B3BA8C0E85C7E4DEB0E8B5256D37BC5C21C8BE068F5342858AFF2FC7FF2644EBED8B10271941C74C86CCD71AA6D2D98E4C8C70875044900F842998037A7DFB9BC63BAF1BC2800E73AF9615E4F5B869D4C6DE6E5F48FACE9CA594CC5D228CB7F763A0AD6BF6ED78B27F902D9ADA38A1FCD7D09E398CE377BB15A459044D3B8541DC6D8049B66AE1662682254E69FAD31CA0016251D0522EF8FE587A3F6E3AB1E5F9D8C2998874ABAB205217E95B234A7D3E69713B884918ADB57360B5DE97336C7DC2EB8A3FEFB0C4290E7A92FF5758529AC45273135427"
+    prime: "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199FFFFFFFFFFFFFFFF"
+    generator: "2"
   e2e:
     prime: "E2EE983D031DC1DB6F1A7A67DF0E9A8E5561DB8E8D49413394C049B7A8ACCEDC298708F121951D9CF920EC5D146727AA4AE535B0922C688B55B3DD2AEDF6C01C94764DAB937935AA83BE36E67760713AB44A6337C20E7861575E745D31F8B9E9AD8412118C62A3E2E29DF46B0864D0C951C394A5CBBDC6ADC718DD2A3E041023DBB5AB23EBB4742DE9C1687B5B34FA48C3521632C4A530E8FFB1BC51DADDF453B0B2717C2BC6669ED76B4BDD5C9FF558E88F26E5785302BEDBCA23EAC5ACE92096EE8A60642FB61E8F3D24990B8CB12EE448EEF78E184C7242DD161C7738F32BF29A841698978825B4111B4BC3E1E198455095958333D776D8B2BEEED3A1A1A221A6E37E664A64B83981C46FFDDC1A45E3D5211AAF8BFBC072768C4F50D7D7803D2D4F278DE8014A47323631D7E064DE81C0C6BFA43EF0E6998860F1390B5D3FEACAF1696015CB79C3F9C2D93D961120CD0E5F12CBB687EAB045241F96789C38E89D796138E6319BE62E35D87B1048CA28BE389B575E994DCA755471584A09EC723742DC35873847AEF49F66E43873"
     generator: "2"
 
-# Selection of scheduling algorithem to use. Options are:
-#   simple - Schedules multiple teams to maximize performance, does not randomly re-arrange teams, if only a single
-#            only scheduling a single team, will use numerical ordering data for AlphaNet
-#   secure - Schedules new teams randomly, has apropreate buffers to ensure unpredictability, designed for BetaNet
-schedulingAlgorithm: "simple"
 
-# Path to file with config for scheduling algorithem within the user directory 
-schedulingConfigPath: "configurations/registration.json"
+# Path to file with config for scheduling algorithm within the user directory
+schedulingConfigPath: "registration.json"
+
+# Path to JSON file with list of Node registration codes (in order of network
+# placement)
+RegCodesFilePath: "regCodes.json"
 
-# Time that the registration server waits before timing out while killing the round scheduling thread
-schedulingKillTimeout: 10s
-# Time the registration waits for rounds to close out and stop (optional)
-closeTimeout: 60s
+# Set address space size for ephemeral IDs
+addressSpace: 32
diff --git a/gen/run.sh b/gen/run.sh
old mode 100644
new mode 100755
index dbb49f5120530d7f3f0728eb6cc3278f43361c13..582cc88e8acdc9712e8e85067a496ccba9e4906f
--- a/gen/run.sh
+++ b/gen/run.sh
@@ -1,5 +1,39 @@
 cp ../network/network.sh temp_network.sh
 
+
+# NOTE: This is verbose on purpose.
+################################################################################
+## Initial Set Up & Clean Up of Past Runs
+################################################################################
+
+set -e
+rm -fr results.bak || true
+mv results results.bak || rm -fr results || true
+rm -fr blob* || true
+rm *-contact.json || true
+rm server-5.qdstrm || true
+rm server-5.qdrep || true
+
+mkdir -p .elixxir
+
+if [ $# -gt 1 ]
+then
+    echo "usage: $0 [gatewayip:port]"
+    exit
+fi
+
+
+NETWORKENTRYPOINT=$1
+
+DEBUGLEVEL=${DEBUGLEVEL-1}
+
+
+SERVERLOGS=results/servers
+GATEWAYLOGS=results/gateways
+CLIENTOUT=results/clients
+UDBOUT=results/udb-console.txt
+CLIENTCLEAN=results/clients-cleaned
+
 mkdir -p $SERVERLOGS
 mkdir -p $GATEWAYLOGS
 mkdir -p $CLIENTOUT
@@ -35,15 +69,19 @@ fi
 
 echo "NETWORK: $NETWORKENTRYPOINT"
 
-if [ "$NETWORKENTRYPOINT" == "localhost:8440" ]
+if [ "$NETWORKENTRYPOINT" == "localhost:{entry_point}" ]
 then
-    source network.sh
+    source temp_network.sh
 
 else
     echo "Connecting to network defined at $NETWORKENTRYPOINT"
     echo $NETWORKENTRYPOINT > results/startgwserver.txt
 fi
 
+echo "localhost:{entry_point}" > results/startgwserver.txt
+
+echo "DONE LETS DO STUFF"
+
 echo "DOWNLOADING TLS Cert..."
 # -alpn h2 added to mimic grpc headers
 CMD="openssl s_client -alpn h2 -showcerts -connect $(tr -d '[:space:]' < results/startgwserver.txt)"
@@ -71,8 +109,72 @@ then
     exit -1
 fi
 
-####################################
+########################################################################
 # Insert client tests here
 
-#####################################
+########################################################################
+
+echo "TESTS EXITED SUCCESSFULLY, CHECKING OUTPUT..."
+
+cp $CLIENTOUT/*.txt $CLIENTCLEAN/
+
+sed -i.bak 's/Sending\ to\ .*\:/Sent:/g' $CLIENTCLEAN/client*.txt
+sed -i.bak 's/Message\ from\ .*, .* Received:/Received:/g' $CLIENTCLEAN/client*.txt
+sed -i.bak 's/ERROR.*Signature/Signature/g' $CLIENTCLEAN/client*.txt
+sed -i.bak 's/[Aa]uthenticat.*$//g' $CLIENTCLEAN/client*.txt
+rm $CLIENTCLEAN/client*.txt.bak
+
+for C in $(ls -1 $CLIENTCLEAN | grep -v client11[01]); do
+    sort -o tmp $CLIENTCLEAN/$C  || true
+    cp tmp $CLIENTCLEAN/$C
+    # uniq tmp $CLIENTCLEAN/$C || true
+done
+
+GOLDOUTPUT=clients.goldoutput
+if [ "$NETWORKENTRYPOINT" != "localhost:{entry_point}" ]
+then
+    rm -fr clients.net_goldoutput || true
+    GOLDOUTPUT=clients.net_goldoutput
+    cp -r clients.goldoutput clients.net_goldoutput
+    # Delete the localhost only files
+    rm $GOLDOUTPUT/client13* || true
+    rm $GOLDOUTPUT/client18* || true
+    rm $GOLDOUTPUT/client19* || true
+    rm $GOLDOUTPUT/client2[01]* || true
+    rm $GOLDOUTPUT/client31* || true
+    rm $GOLDOUTPUT/client3[56]* || true
+    rm $GOLDOUTPUT/client45* || true
+    rm $GOLDOUTPUT/client56* || true
+    rm $GOLDOUTPUT/client67* || true
+    rm $GOLDOUTPUT/client74* || true
+    rm $GOLDOUTPUT/client9* || true
+fi
+
+
+set +x
+diff -aru $GOLDOUTPUT $CLIENTCLEAN
+cat $CLIENTOUT/client42.log | grep -a "Could not confirm authentication channel" > results/deleteContact.txt || true
+
+if [ "$NETWORKENTRYPOINT" == "localhost:{entry_point}" ]
+then
+
+    #cat $CLIENTOUT/* | strings | grep -ae "ERROR" -e "FATAL" > results/client-errors || true
+    #diff -ruN results/client-errors.txt noerrors.txt
+    cat $SERVERLOGS/server-*.log | grep -a "ERROR" | grep -a -v "context" | grep -av "metrics" | grep -av "database" | grep -av RequestClientKey > results/server-errors.txt || true
+    cat $SERVERLOGS/server-*.log | grep -a "FATAL" | grep -a -v "context" | grep -av "transport is closing" | grep -av "database" >> results/server-errors.txt || true
+    diff -aruN results/server-errors.txt noerrors.txt
+    IGNOREMSG="GetRoundBufferInfo: Error received: rpc error: code = Unknown desc = round buffer is empty"
+    IGNORESERVE="Failed to serve "
+    IGNORESTART="Failed to start "
+    cat $GATEWAYLOGS/*.log | grep -a "ERROR" | grep -av "context" | grep -av "certificate" | grep -av "Failed to read key" | grep -av "$IGNOREMSG" | grep -av "$IGNORESERVE" | grep -av "$IGNORESTART"  > results/gateway-errors.txt || true
+    cat $GATEWAYLOGS/*.log | grep -a "FATAL" | grep -av "context" | grep -av "transport is closing" >> results/gateway-errors.txt || true
+    diff -aruN results/gateway-errors.txt noerrors.txt
+    echo "Checking backup files for equality..."
+    # diff -aruN $CLIENTOUT/client120A.backup.json $CLIENTOUT/client120B.backup.json > client120BackupDiff.txt
+    diff -aruN $CLIENTOUT/client121A.backup.json $CLIENTOUT/client121B.backup.json > client121BackupDiff.txt || true
+    # diff -aruN  client120BackupDiff.txt noerrors.txt
+    echo "NOTE: BACKUP CHECK DISABLED, this should be uncommented when turned back on!"
+    #diff -aruN  client121BackupDiff.txt noerrors.txt
+fi
+
 rm temp_network.sh
\ No newline at end of file
diff --git a/gen/server.yaml b/gen/server.yaml
index 026c367bb515dab4b4c5da22406b3f3462c620c1..b2a72b495ed76a91b560387d3b4087183ef350ee 100644
--- a/gen/server.yaml
+++ b/gen/server.yaml
@@ -1,23 +1,25 @@
 # START YAML ===
 registrationCode: "AAAA"
 useGPU: false
+devMode: true
+rawPermAddr: true
 logLevel: 2
 
-node:
+cmix:
   paths:
-    # Path where the ID will be stored after the ID is created on first run
-    # used by the wrapper script
-    errOutput: "errServer-0.txt"
     # Path where the ID will be stored after the ID is created on first run
     # used by the wrapper script
     idf:  "nodeID-1.json"
     # Path to the self signed TLS cert that the node uses for identification
-    cert: "configurations/keys/server-1.crt"
+    cert: "../keys/cmix.rip.crt"
     # Path to the private key for the self signed TLS cert
-    key:  "configurations/keys/server-1.key"
+    key:  "../keys/cmix.rip.key"
     # Path to where the log will be stored
-    log:  "server-1.log"
+    log:  "results/servers/server-1.log"
+    errOutput: "results/servers/server-1.err"
+    ipListOutput: "results/servers/iplist-1.txt"
   port: {NODE_ADDR}
+  overridePublicIP: "127.0.0.1"
 database:
   name: "cmix_server"
   username: "cmix"
@@ -26,13 +28,13 @@ database:
 gateway:
   paths:
     # Path to the self signed TLS cert used by the gateway
-    cert: "configurations/keys/gateway-1.crt"
-permissioning:
+    cert: "../keys/cmix.rip.crt"
+scheduling:
   paths:
     # Path to the self signed TLS cert used by the permissioning. Provided by xx network
-    cert: "configurations/keys/permissioning.crt"
+    cert: "../keys/cmix.rip.crt"
   # IP Address of the permissioning server, provided by xx network
-  address: "0.0.0.0:11420"
+  address: "0.0.0.0:{permissioning_port}"
 metrics:
   # location of stored metrics data. Modification to set to permissioning
   # server instead of saving will be made at a later date
diff --git a/gen/udb.yaml b/gen/udb.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..9a7ae21742a3eb007acf018dc96d58b1859f21a4
--- /dev/null
+++ b/gen/udb.yaml
@@ -0,0 +1,10 @@
+# UDB Config for E2E Integration test
+log: "./results/udb.log"
+sessionPath: "./results/udbsession"
+sessionPass: "hello"
+certPath: "../keys/cmix.rip.crt"
+port: "{udb_port}"
+keyPath: "../keys/cmix.rip.key"
+permCertPath: "../keys/cmix.rip.crt"
+permAddress: "0.0.0.0:{permissioning_port}"
+devMode: true
\ No newline at end of file
diff --git a/gen/udbContact.bin b/gen/udbContact.bin
new file mode 100644
index 0000000000000000000000000000000000000000..10b08460a8ec87eaa6474298845d1deaa9482a5c
--- /dev/null
+++ b/gen/udbContact.bin
@@ -0,0 +1 @@
+<xxc(2)uu49Kr9myQUG0gG8VKwalxmem65pfPu4D2Lk1u8pi/UDrgZ7Ugdw/BAr6QTgt3dDqBSTfbLpgWOpOQvmR1bACzi52YiM90WbtsF4Iy5RZ64mRVbzN+erifSAaH8JAWSoK23KmMJH9F/HqBBwMjWJmpmkpxR0wo4bHDoBnHulqnBf/WxsHBeLk6HRbWqXWljV3LnO0ugSZDxa3cNu8mjfMNnxgoQr3JWY/bgiAHUGvUSHGxfMgmRvbxuFe3TRO9ZNVGhIC291GsvA+6kKnIjC2NuHu+UZ5Gmk86fw/1kbVK6lxFZsWN7dDgDrodUMc0Bnq2fQ+pmwP26x2Wj5tUHUKK+VHqmY+DGHg/RObjpgnr1qctl3/+gpL83Q3TyWwAjH/73tVww/M6lDnFYxAb62k0NYtVKZVFPDqrocFyAlDXaReg1it9VNJSPYiUM4TCimMmtYL6AgcXdMeD5E7UX1vsvmA5Ll9jZNOmoyPWLYt5W9Gvl79Xqgzqlf0t1DxR4ZmFtG/NwH3S1gCARcIlYgCb66j2gifEMH7aAQWyW8YLm2hEZmwLxISnIPjEL3gIOzNHtmGGXN23jUIwAAAgA790tNCG8KTm8tuEBiH/sjKg==xxc>
\ No newline at end of file
diff --git a/gen/udbProto.json b/gen/udbProto.json
new file mode 100644
index 0000000000000000000000000000000000000000..940cadfe9b1bb56946fd38a8c677207245add9e3
--- /dev/null
+++ b/gen/udbProto.json
@@ -0,0 +1 @@
+{"TransmissionID":"MhaUvxgJp0REgqp/FNes3ddICg1vKmIIUr+hABI9PXgD","TransmissionSalt":"aUdWmk0Dtu8YZ9N4fUCl80QAmCZ+eY96BDTAN9//9kI=","TransmissionRSA":{"N":744095517605335188486192402593567285818149781037814392671915097997165799160704009076529206117565015316892087089782583938102479243183663906078668582528984516276493241709164519970005583971481012694667579696383360567823504989650655410246207331522294633002054530951336779742521949130565223443549835766371552961634577790108359687869697030104209247319401651289712207512551543251668177804743453344668589351336794674335174328494860289416890175422687829958938924106165398205285038813958087994742173028066268997679203164659373760933342345626244738488110458781897756397149360694648367300111068967014678500898983090333707836644483738687322761365319344259236535454689996343110842585871572930571278463402471136616034421156328875234527272277980275379473515969296415235308154781609704415193243251254222667078013823356321213274280009612841451973719445431427792198300346805888677562529255025870805189890421627704987545754460307965087998094692006804411392783507966480991167024256590215549839475685306270811326657913050667578064503246626321836700579972796860953792588080819942544062977767967992236600692121009380090485897336412623665757415839315721348591326702012914394412545952829437103713850347584948953528257126120160975904938795178616150713777831589,"E":65537,"D":702540524327712978286466077105790056678969955922255232545891489063744574128612569535199928085456619203859372153966109927796010011603759273638246729040785738035622202988204724082335711421080162694477101925219543187134214539033120295707837878642675511638740378895522619590888057835298904908929813505588790799198357720349344223969868061274671644969751681902643121660346855086187525184614960443841773399647021439245580083376969805274103382587388114414289085660271241356003819929067314812253558149711712876228635033944612512096562618373058664318305855593748378360108198295661336701847393296488506669516858822963804260311691759542739227343536282374650987690037136673732778544975139599300829103845745104309687652878356279709829981494578600603924386279381105751731671579921080691074783353253958778076575957155595416051906390745893233111609000272562409467803170191115741547810223834894875859746256757717726366292758015729401293357270389003259918967902654657293283011346796119435418406947470723708887763547764820828540891209479365431423513260945988353481802346962185241475598840911175187647890159503133204568937310632267175230680232531126383217383814916312952923810037599497876585604599444464808553067231902765607317662766023981051800036686273,"Primes":[26431524235468771028852443590104055376636364921067197450041684258482439988835561020261125258562308094700689754910670346007026107201010688328852518422104352082149765577020457481232265846864075786524112374194109435619505107638299597352847727718122930754740563865787954820820245269180427904294490102595163613363903301612449832540143489589841021282833070290450230168473246516211511298499533872232550844877914066189330777819461606196011609435557144318950621971682270122109937087991576359208132704648705570764167630153594184009208403478937807655656357669009470285691425163502536227383519714393737089527860969984842067786101,28151820189273258942344071129053694480161436139819710188331124791415914831471008775403858034120373831438530464789505032183420165894885328994613924494905439083295166072103442061113078040409562754110291758200572034754286027961921301572668934253552291343681689448082037497152344335274886686268374921532985704635156460979764429070570728443686028271768081803840073189209047377853848238258439123998890243019814395279696459993201039305339332983028931741597790390904270131316198444444886804187393230626448411790408221074812330007942755799986304653723364502190308487509016389841021566288050103973334556368552133193493944408689],"Precomputed":{"Dp":275861918871181765777119358768805009042514512504538856765315959424477607341860685381671569904887601458340659358208317693345833000068530918670905329824669680092015802595205653556965833639852721943062588521732316919659756986505285939077892576089782636316013025988357127995499454722056436616528544641577916467658114626896496413590157420685280964301964082558981299651123802082620103577729849834552463156636605601011676641111307179731631610447855207198410446444461491425045347943699562532590182186851925025599137266354249078570861467256564390137921306217899471678791138011134699170397294423689155274685397614624288178673,"Dq":20251853375093108718674238635432892563921007495734318881533472838489627548476924176040866851955981272517828971313395551327029420652154717499734014133036480629583806088703921134828221879139253331786377393413250059516388743370809492102858684015410780592477790114275535038844384485571048533054744709867618963802570860877854857148803386838061270563205181572605460893517398533291080291147479606024866554731101049481309326072897084076010928068387048779916221764340337818499984617266561381665606317822215493877818423040314663633588189342602717841897580646356474723470712524458623415234392941421286158880506566848352312481377,"Qinv":1782249293930479585148549445278205034617546516712012566064256819261113180298258405511667713490475276726336613818509018461173201977639000556416891523605685233456051292911470649097170785609362912595510275601045219404262259673943809118153699614833210258102652927663612925023313592281316017977621743103307097046836057862305643762370317914029974246165942098634086048350280652529323604758408742898452312792547897909618079071765102987807077305433629474092046709583007609210604882495077254479038254736382806594706188378137791260031991135639188023310238199612626314094372849297487936335153146414944425343861682455207985266708,"CRTValues":null}},"ReceptionID":"uu49Kr9myQUG0gG8VKwalxmem65pfPu4D2Lk1u8pi/UD","ReceptionSalt":"M8xD+2gHGbqwKPwHFxs7+IjutQYuyBUkX2H257o5BdU=","ReceptionRSA":{"N":850387188153991188889446100749739241848829271482462061108409439312531431988795734813327514693008344548532502397064837726907012068926804456615485530991075075479632026273101933309061970039508777559060326644210787796911046233949155489473727669005294322689793791335544727360305644959942063168476363583581030898050353126928764965273874658694962134566452334451854924568242626514389265043292391299760010067072010852660228863317130740474026897759770820934809759670185849936472580423333979237659958984231856174610567212253308506984182380860548206401655999782332308043025450559980137052816211530713615583429240205892728859426128000967414395838939110894033790769681039750313146913688429864118346214901692066118374534016813397369786419474818398950057293996832967235881835337432259690040386208608584839830051784956186429114899224875646403109211367267143599678019107255952565689487312514740269900292167402469336239686704437448306260169629496444993371773823439258565787685710030837201534059640894021404396138451751712905956843779570695671045422782022593718074598748351627333401529057059641321731684199811309173775075814578877100319468485440759413419208114295109676086784903373038008038594143762297734223790838124082684159063469085109435783518725031,"E":65537,"D":564922212042972891506779603709986684962272914422874876092540423872769289935398323184885484645154711027502930510414145293747815500326018670791589385580030144211006599750553715770887147559547944650942359905229184557030627277529401445675232029624235148495438489607025204008203409747486116303247866721674280821649117660056115481226310038842219913218786872835656314004723732098768107056926939591645201310559136617365280437344369150983684163873340894930173985790635539446178597340291613196667556255191759193646646393943456253239701974694076434107586512390304739235381525566166520085882164295171867519962140940902875266686494581933486332733070115573951932064475826442525759304559384157338056633545437785084083189928354125207030609304055082642325819334882909664939190272656190536034921638933681026317152328190142016810293928283213410554345222497221023348512487512997673475708771529517243600219742073183452616019438402558324904073954972062329692828835961585134598049832023174978649417520451705037067815379933732830551892585260348438752787466224668527842810502446714266623795601014094978116799695556231619140778349831856996205593248896859777976571100881350185386707051672977669257878795867903988402998091514995549897864288962757393054768438537,"Primes":[29492971595987200184565588575492524180677323915637743461334512913337954089756992535478030745356298455923396638365524831317118482754099964262507886663300281433334915984551779676428190574578201359535331987821184071989738056990202803783701055959370528270478305175226218851763791555786561228871062383690072445559534386478623474224364245986294525688152961853703225064960942669169364540334937714823971415905428637789133243443480147178878208486722743719938775945712937478778805521783173263515825112840086735855547887576584469859603118910509756820711149404941056507505214523564857945496996487150674719706390219045171074335669,28833553966793039902622472693344948085468484145845354555175845509525852913656457209339298633228826325187527465622133573224700820135296269687184379379824668957542611483930310268532473436266625079565533379890421336412596736616538404624204368463036294562591617517553183068875112160214949467183247851787117317409259574446000362822944034217039330133706829603389396809485151845126091352794981119059018300220209826040784745553271153888708759107151118112035826198322288728622562498893857193711017030398086686353945134010647373894524028231986696810322055915091233789726845203397655178875279735934668248673328323303568542440299],"Precomputed":{"Dp":22035237410890233868459863048338975639819722683815281575052938413439628332162765147926847055043275613688284730725665248110879449899362264829236899315936009893392193130347405158251161198776593825925012295095354961090338647794761436856568384348544759704654930999358405268422632307384972924785564942206454328040993656009976019887941091363945732186709946704404815833892496723925079492767447780739975286934240402358132188919389129905454498658046281432577050584888444445861180895892596225766397251174372446422126467723384631073675430939059008540612500276377295754916960329986927526454681065555835446395523094977597412985733,"Dq":16841607730729779627880254737037774275779080108991259477426970506807599516834294855936468737964805708655851677434354230175954764404521738920387232291067463077265226781891943132572792211121754246391635530802528781571848010706640373056663308127699305062117691053480260736325118535987736173516864180026715457076559142313393867416303731172135824915975669274116088772252187506773681691029370847575861277330815144740242001614038173411351927897550159472187183222786780178092858880596561535853910492143960790906343282877269046075993405262988094570992390564561887627916194430414303984731460217763692273970657921724531238912593,"Qinv":13386450555509069245317666985331292478728039484440837065189457918756926085772889573452664818969207436096145088071795396654392004940595219762405312750934346518716740936238520072004578261328949676162223098531690599793600587771458065485838287464893640290027597304483114889945915722313306140200593797334834667938307085618314432134506785949791967130287157125647210497214516165218726084383497011560605024384546734297139331536623591040849235382041138776467271730696249828686335872619825082175542573979118200539219034800857165800266206532665733326893998872307865475986277696080650713536968589910998008126592314634991854532329,"CRTValues":null}},"Precanned":false,"RegistrationTimestamp":1640900456461843040,"RegCode":"","TransmissionRegValidationSig":"Zln6nmiiuvO2vZGe4jMrHyEWyd3j89GYUjnugb88V+1Q/mdn9BFV/qmiBpnoNyqAn5XOpHmkYOw0DkBX2Tc3w5NQWHiLgcrAMHlZUkinFZ2/jWeLNGuWTFmauu2q+z1C4R/reAjlRiyo2OuKBZxFoE3mbw85mWYoiyyMbEfyNCHK2ScCmdapHP5kSzWeUi2WjaNi+LUBqmWMLX9nWZs24YD6VapNnStcj7w14XTWtUJ/oXtgwI/uMDa3ZvLwCO6JwsRR3VGq98Dbky4eJhXwCnFTW/Jy/ZR5n3xPccU3Eb+/0eHyYwZGORe0Tr7qGq0YI9wFNfjv3rpEmqqScq9sHg==","ReceptionRegValidationSig":"ABBNeRb2gEVIi/LU3c4rwTxauQpJ0PV0Dp78JT3QGXyoThMjDIgpCZHZRr8clexXkDSNZ0GZCKLQtv48e2TJbO15oodzKZq9fS6HPNc/D2l17DBbNCFTy+kM7MKIqHU4dN2h/fhjYgQ0k3WaR04NGSFtX4FSyeDqh8LbQAlrvKn13Z1fCId6kt9Sp3GTWtRMm2RD3hRNYLzrFHqAiH/rDcMy/d4Ar9wTwKlIcFyX3+1ENjAxTcsnjno7+aa5tT8XI0HdlcvrMDkx+m2kbHquqGJM9hCg/XxhrLFqsjY0F0bVp7J2UeHoLw6s6OgEl9Eg5I0k51K+SSMa1Mse1zggkg==","CmixDhPrivateKey":{"Value":23134336198863750741748703660400387868824411194091704843877765878704684400020511760943730932032181255742725205976185967794840498055119688330124475657025083380879051516507316264855378759159543513707252259922784173347685874456358247463151784175729466898154272096842618045994973870223785531415217217965394756900460790339174016946558150507580144972427210564566872862707000226886100833409714665643615263325876515987666291734559374206190550344559412403144311029314745799204676946278572048079685978558133653417488694953610922501137922416052437955367323383147526279158425720871674296239641638893436600760625905793653337291326,"Fingerprint":1019130854791890857},"CmixDhPublicKey":{"Value":40661473203398365346021139834751279657661515042218153062933068745659041507124553367048607412838109996778705972152516147090017024944177990861357148498071195775787956973205443551118903422765769934453067811496751124796541305224646917714432655244199681118218184307551604728113020909007420531039281826284338933975869040846161322930224431922676228280139352116332784218225442881629816602619617561152949947075502732590198688997850331029595028876889786739167152345971604837504050490241011792155573239919262293917635508122225378077992880296300468988471302542680432268331360185693269950450132051419581315000110594207999508607050616011689445128093546507459669376840509120845943383094511932011628510767784841945662325523012877900497552502527594150800481434891933803449151469858078545202819003974303280259033864766743161709598642156724209578764288690522108924880552091308234645729967740909969025514152089886697815454891469560150611996697804062619010044123824507982370347027313396405015494843434897303661589566168416699605512854149233601685403032629550047093556970695648101495563847168540708660964238960062140890332386702253196064038177801032833477139196626595095716721717130200091320630907308046939829403546847081437153253274137106108481349472925,"Fingerprint":1019130854791890857},"E2eDhPrivateKey":{"Value":15868054927490624034769207675284372396111367138702747294809526549406434197505594302868553416930040949078939726209524016245099170354423124146109791439676150153811847753697222698706991672115541614080484720172498069738416608757527621565114235134343850506971256805006649306801742780960331446133932778313421336826492419515327757859355790985926801091202339643161980910811435573134233363961673385626782920679443568800015505367010870530111147205683029126252427303195582360585233280495455148410685790997024364716148825012857917467229638326785383545555885827743352446807694303549475074691875396849487056555719913457474008032697,"Fingerprint":16801541511233098363},"E2eDhPublicKey":{"Value":147139791407699234997192910595075527435460061524772944343748681206265869846642332345707990677406040145177534321538182440717890359993428686109525202118205223891431899168261959123977071363023161983520620405235747590084693661804115691677488049367521195795602971625363864492999496527190606383593289607097185210792999982667279095678826515909506042508081456493456997354040504436530126940434391612132572210469911068602346111602950742796752446044197938946885845119733654743975968520762482827365434031479613917149883640347855512864879556669871625702373555191119636414088476652878563700716501799409607427689929171266147047756204689439519092680494886131474665331718064247744119146288064620933248987203778241513546175445638858254194548267620960510274776658377038971793051901595492445943697519511203993381901627766295075444537422179881027670118336783809271801530698319821686375879565780071214330909899155111647279589474822393047955732167728825532445888096165721311471522851,"Fingerprint":16801541511233098363}}
\ No newline at end of file
diff --git a/generatePackage.py b/generatePackage.py
index 81d166a94f88c30ae613d249826d2fe65dd67be1..39b3591bcf509e8ca5012c2868a74d3fb30d02af 100755
--- a/generatePackage.py
+++ b/generatePackage.py
@@ -11,6 +11,8 @@ def random_string(stringLength=4):
     letters = string.ascii_lowercase
     return ''.join(random.choice(letters) for i in range(stringLength))
 
+nodes = 5
+
 
 # Generate a list of all ports servers and gateways occupy. Doing this as a
 # separate step because their configs need every one listed, and generating them
@@ -23,8 +25,8 @@ def create_ports_list(offset, manualOffset=0):
     node_regCodes = []
 
     for i in range(nodes):
-        gateway_ports.append(1000 + 1000 * offset + manualOffset + i)
-        node_ports.append(10000 + 1000 * offset + i)
+        gateway_ports.append(1000 + 10 * offset + manualOffset + i)
+        node_ports.append(10000 + 10 * offset + i)
 
         regCode = random_string()
         # If this regCode is already in the list, we loop until we get one that
@@ -32,61 +34,106 @@ def create_ports_list(offset, manualOffset=0):
         while regCode in node_regCodes:
             regCode = random_string()
         node_regCodes.append(regCode)
-    return gateway_ports, node_ports, node_regCodes
+    
+    permissioningPort = 20000 + 10 * offset
 
-# Generate server and gateway configs
-def generate_server_side_config(offset, newPackage):
+    udbPort = 30000 + 10 * offset
 
-    nodes = 5
 
-    server_template = ""
-    with open("gen/server.yaml") as f:
-        server_template = f.read()
 
+    return gateway_ports, node_ports, permissioningPort, udbPort, node_regCodes
+
+# Generate server and gateway configs
+def generate_server_side_config(offset: int, newPackage: string):
+
+    # Open gateway template
     gateway_template = ""
     with open("gen/gateway.yaml") as f:
         gateway_template = f.read()
 
+    # Open network config
+    network_config = ""
+    with open("gen/network.config") as f:
+        network_config = f.read()
+
+    # Open no errors template
+    no_errors = ""
+    with open("gen/noerrors.txt") as f:
+        no_errors = f.read()
+
+    # Open permissioning template
     reg_template = ""
     with open("gen/permissioning.yaml") as f:
         reg_template = f.read()
 
-    reg_json_template = ""
-    with open("gen/registration.json") as f:
-        reg_json_template = f.read()
+    # Open server template
+    server_template = ""
+    with open("gen/server.yaml") as f:
+        server_template = f.read()
+
+
+    # Open run script template
+    run_template=""
+    with open("gen/run.sh") as f:
+        run_template = f.read()
+
+    # Open udb config
+    udb_config = ""
+    with open("gen/udb.yaml") as f:
+        udb_config = f.read()
 
+    # Open udb contact
+    udb_contact = ""
+    with open("gen/udbContact.bin") as f:
+        udb_contact = f.read()
 
+    reg_json = ""
+    with open("gen/registration.json") as f:
+        reg_json = f.read()
+    
+    # Open udb proto file
+    udb_proto = ""
+    with open("gen/udbProto.json") as f:
+        udb_proto = f.read()
+
+    # Create package 
+    if not os.path.exists(newPackage):
+        os.makedirs(newPackage)
 
-    gateway_ports, node_ports, node_regCodes = create_ports_list(offset)
+    # Create gold sub-directory
+    if not os.path.exists("{}/clients.goldoutput/".format(newPackage)):
+        os.makedirs("{}/clients.goldoutput/".format(newPackage))
 
 
+    gateway_ports, node_ports, perm_port, udbPort, node_regCodes = create_ports_list(offset)
 
     for i in range(nodes):
-        with open(newPackage + "/configurations/servers/server-{}.yml".format(i), 'w') as f:
+        with open("{}/server-{}.yaml".format(newPackage, i+1), 'w') as f:
             # Array of strings defining node and gateway IPs and ports
             node_addrs = []
             node_addrs.append("\"{}\"".format(node_ports[i]))
 
             # Create a new config based on template
-            s_config = server_template.replace("server-1", "server-" + str(i)) \
+            s_config = server_template.replace("server-1", "server-" + str(i+1)) \
                 .replace("gateway-1", "gateway-" + str(i)) \
                 .replace("{NODE_ADDR}", "\r\n".join(node_addrs)) \
                 .replace("{DB_ADDR}", "".join(["\"\""])) \
                 .replace("AAAA", node_regCodes[i]) \
                 .replace("nodeID-1.json", "nodeID-"+str(i)+".json") \
-                .replace("errServer-0.txt", "errServer-"+str(i)+".txt")
+                .replace("errServer-0.txt", "errServer-"+str(i)+".txt") \
+                .replace("{permissioning_port}", str(perm_port))
             f.write(s_config)
 
 
-        with open(newPackage + "/configurations/gateways/gateway-{}.yml".format(i), 'w') as f:
+        with open("{}/gateway-{}.yaml".format(newPackage, i+1), 'w') as f:
             # Array of strings defining node and gateway IPs and ports
             node_addrs = []
             node_addrs.append(" \"0.0.0.0:{}\"".format(node_ports[i]))
 
             # Create a new config based on template
-            g_config = gateway_template.replace("server-1", "server-" + str(i)) \
-                .replace("gateway-1", "gateway-" + str(i)) \
-                .replace("8200", str(gateway_ports[i])) \
+            g_config = gateway_template.replace("server-1", "server-" + str(i+1)) \
+                .replace("gateway-1", "gateway-" + str(i+1)) \
+                .replace("{GW_ADDR}", str(gateway_ports[i])) \
                 .replace("{NODE_ADDR}", "\r\n".join(node_addrs)) \
                 .replace("gatewayIDF-0", "gatewayIDF-" + str(i))
 
@@ -95,12 +142,12 @@ def generate_server_side_config(offset, newPackage):
 
 
     # Generate regCodes file
-    with open(newPackage + "/configurations/regCodes.json", "w") as f:
+    with open("{}/regCodes.json".format(newPackage), "w") as f:
         f.write("[")
 
         for i in range(nodes):
             f.write("{\"RegCode\": \"" + node_regCodes[i] + "\", \"Order\": \"" + \
-                str(i) + "\"}")
+                "CR" + "\"}")
             # If not the last element, write a comma
             if i is not (nodes - 1):
                 f.write(",")
@@ -108,6 +155,47 @@ def generate_server_side_config(offset, newPackage):
         f.write("]")
 
 
+    # Generate network config
+    with open("{}/network.config".format(newPackage), "w") as f:
+        network_config = network_config.replace("{entry_point}", str(gateway_ports[0]))
+        f.write(network_config)
+
+    with open("{}/permissioning.yaml".format(newPackage), "w") as f:
+        reg_template = reg_template.replace("{permissioning_port}", str(perm_port))  \
+            .replace("{udb_port}", str(udbPort))\
+            .replace("{registration_port}", str(perm_port+1))
+        f.write(reg_template)
+    with open("{}/registration.json".format(newPackage), "w") as f:
+        f.write(reg_json)
+
+    with open("{}/noerrors.txt".format(newPackage), "w") as f:
+        f.write(no_errors)
+
+    with open("{}/run.sh".format(newPackage), "w") as f:
+        run_template = run_template.replace("{entry_point}", str(gateway_ports[0]))
+        f.write(run_template)
+
+    # Set the executable permissions on the bash script file
+    os.chmod("{}/run.sh".format(newPackage), 0o755)
+
+    
+
+    # Write udb config
+    with open("{}/udb.yaml".format(newPackage), "w") as f:
+        udb_config = udb_config.replace("{permissioning_port}", str(perm_port))  \
+            .replace("{udb_port}", str(udbPort))
+        f.write(udb_config)
+
+    with open("{}/udbContact.bin".format(newPackage), "w") as f:
+        f.write(udb_contact)
+
+    with open("{}/udbProto.json".format(newPackage), "w") as f:
+        f.write(udb_proto)
+
+
+
+
+
 # Count the number of packages previously created by counting
 # run.sh files creates
 def count_run_sh_files():
@@ -123,19 +211,19 @@ def count_run_sh_files():
 def main(argv: Sequence[str] | None = None) -> int:
     run_sh_count = count_run_sh_files()
 
-    parser = argparse.ArgumentParser()
-    subparsers = parser.add_subparsers(dest="command", required=True)
-
-    # Add sub-commands
-    count_parser = subparsers.add_parser("count", help="This will count the number of run.sh and print the result.")
-    count_parser.add_argument("string")
+    parser = argparse.ArgumentParser(description='Generate or count packages')
+    subparsers = parser.add_subparsers(title='subcommands', dest='command')
 
+    # "generate" subcommand
+    generate_parser = subparsers.add_parser('generate', help='Generate packages')
+    generate_parser.add_argument('--package', required=True, help='Name of the package')
+    generate_parser.add_argument('--offset', type=int, default=0, help='Offset value')
 
-    gen_parser = subparsers.add_parser("generate", description="Generates a template package that can be used for client tests.")
-    gen_parser.add_argument("offset", type=int, default=0, help="Optional argument. Used when several programmers are separating tests simultaneously.")
-    gen_parser.add_argument("pkg", help="The name of the package that will be generated.")
+    # "count" subcommand
+    count_parser = subparsers.add_parser('count', help='Count packages')
 
-    args = parser.parse_args(argv)
+    # parse the arguments
+    args = parser.parse_args()
 
     if args.command == "count":
         print(f"Number of occurrences of run.sh in all subdirectories: {run_sh_count}")
@@ -151,7 +239,7 @@ def main(argv: Sequence[str] | None = None) -> int:
         # Request new package name from user
         #newPackage = string(input("Name of new package: "))
         #os.makedirs(os.path.dirname(newPackage), exist_ok=True)
-        generate_server_side_config(run_sh_count + args.offset, args.pkg)
+        generate_server_side_config(run_sh_count + args.offset, args.package)
     else:
         raise NotImplementedError(
             f"Command {args.command} does not exist.",
diff --git a/network/network.sh b/network/network.sh
index 372f9000697a41f91e4e9d9839c434145377f242..2a7b2cc2adb2c633f711ed15fe2825a00a4caee9 100755
--- a/network/network.sh
+++ b/network/network.sh
@@ -7,7 +7,6 @@
 
 echo "STARTING SERVERS..."
 
-SERVERCONFIG=servers/
 SERVERLOGS=results/servers
 GATEWAYLOGS=results/gateways
 UDBOUT=results/udb-console.txt
@@ -31,7 +30,7 @@ echo "$CLIENT_REG_CMD -- $PIDVAL"
 for SERVERID in $(seq 5 -1 1)
 do
     IDX=$(($SERVERID - 1))
-    SERVERCMD="../bin/server --logLevel $DEBUGLEVEL --config $SERVERCONFIG/server-$SERVERID.yaml"
+    SERVERCMD="../bin/server --logLevel $DEBUGLEVEL --config server-$SERVERID.yaml"
     if [ $SERVERID -eq 5 ] && [ -n "$NSYSENABLED" ]
     then
         SERVERCMD="nsys profile --session-new=gputest --trace=cuda -o server-$SERVERID $SERVERCMD"
@@ -109,6 +108,3 @@ while [ ! -s rid.txt ] && [ $cnt -lt 30 ]; do
     echo -n "."
 done
 
-echo "localhost:8440" > results/startgwserver.txt
-
-echo "DONE LETS DO STUFF"
\ No newline at end of file
diff --git a/test.py b/test.py
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000