diff --git a/UDP-client-server.py b/UDP-client-server.py
index 6c9e392bc7df58028e75621f12550dbc519899ca..092c374b0de0c1b7c8739e699444bae2cf7e243b 100644
--- a/UDP-client-server.py
+++ b/UDP-client-server.py
@@ -2,6 +2,8 @@ import socket
 import time
 import sys
 from threading import Thread
+import numpy as np
+from array import *
 
 #DEFINE INPUTS HERE
 #CLIENT - SENDER
@@ -31,8 +33,10 @@ def udp_client_receive(UDP_RECEIVE_IP, UDP_RECEIVE_PORT):
     global cumulative_delay
     global min_delay
     global max_delay
+    global rt_delay_array
     min_delay = 100.
     max_delay = 0.
+    rt_delay_array = array('f')
     packet_count_rcvd = 0
     cumulative_delay = 0.
 
@@ -51,11 +55,14 @@ def udp_client_receive(UDP_RECEIVE_IP, UDP_RECEIVE_PORT):
         packet_number = str(splitdata[1].strip("' '"))
         packet_number = packet_number.lstrip('0')
 #WRITE TO FILE AND DO PACKET COUNT
-        #outfile = open("udp_twoway_results.csv", "a").\
-        open("udp_twoway_results.csv", "a").\
+        outfile = open("udp_twoway_results.csv", "a").\
             write(str(time.ctime() + ',' + 'received , ' +
                       packet_number + ' , ' + str(rt_delay) + '\n'))
 
+# Store all rt_delay for std.dev. calculation
+
+        rt_delay_array.append(rt_delay)
+
         print (time.ctime() + ',' + 'received , ' +
                packet_number + ' , ' + str(rt_delay))
 
@@ -64,11 +71,12 @@ def udp_client_receive(UDP_RECEIVE_IP, UDP_RECEIVE_PORT):
             max_delay = rt_delay
         if rt_delay < min_delay:
                 min_delay = rt_delay
-        print (max_delay, min_delay)
 
         packet_count_rcvd = packet_count_rcvd + 1
         cumulative_delay = cumulative_delay + rt_delay
 
+    outfile.close()
+
 
 #CLIENT SERVER SIDE
 def udp_client_send(UDP_DEST_IP,  UDP_DEST_PORT,
@@ -112,12 +120,19 @@ def udp_client_send(UDP_DEST_IP,  UDP_DEST_PORT,
     time.sleep(5)
     # Perhaps create a custom object where we store the statistics?
     # Or from here save it directly into the database?
+
     PLR = 100 - ((packet_count_rcvd * 100.) / packet_count_snd)
 
     print '\n', packet_count_snd,  'packets sent'
     print packet_count_rcvd,  'packets received'
     print 'packet loss ratio = ',  round(PLR, 3),  '%'
 
+    print 'range =', (max_delay - min_delay)
+
+#CALCULATE THE STANDARD DEVIATION
+
+    print 'std. dev.: ', np.std(rt_delay_array)
+
     if packet_count_rcvd == 0:
         pass
     else: