diff --git a/Wc b/Wc
new file mode 100755
index 0000000000000000000000000000000000000000..bda1e13403eea5bfe910110cbbbde42feeb7c194
Binary files /dev/null and b/Wc differ
diff --git a/inc/FileObject.h b/inc/FileObject.h
index 9267f77cc63ca26b7302a3534c7ef7d470dd4f87..b3b8a8ad0f55e632ad34dea6cae6af53e4ca8063 100644
--- a/inc/FileObject.h
+++ b/inc/FileObject.h
@@ -6,11 +6,16 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <fstream>
+#include <unistd.h>
+#include <dirent.h>
+#include <sys/types.h>
 
 #include "HashRing.h"
 
 using namespace std;
 
+string getMostRecentFile(string readfile);
+
 class FileObject {
 public:
 	string fileName;
diff --git a/inc/MessageTypes.h b/inc/MessageTypes.h
index 675bdf10460945dde316ee810a20de2e0ee77049..f7a19773f4490f9dc7a2775585d1f2675afd52a5 100644
--- a/inc/MessageTypes.h
+++ b/inc/MessageTypes.h
@@ -1,6 +1,36 @@
 #ifndef MESSAGESTYPES_H
 #define MESSAGESTYPES_H
 
+const static char *messageTypes[] =
+{
+	"ACK",
+	"JOIN",
+	"LEADERHEARTBEAT",
+	"LEADERPENDING",
+	"HEARTBEAT",
+	"SWREQ",
+	"SWRESP",
+	"JOINRESPONSE",
+	"JOINREJECT",
+	"ELECTION",
+	"ELECTIONACK",
+	"PUT",
+	"PUTACK",
+	"LEADERACK",
+	"DNS",
+	"DNSANS",
+	"DNSGET",
+	"DELETE",
+	"GETNULL",
+	"REREPLICATE",
+	"REREPLICATEGET",
+	"MAPLESTART",
+	"JUICESTART",
+	"MAPLEACK",
+	"CHUNK",
+	"CHUNKACK",
+};
+
 enum MessageType {
 	ACK,
 	JOIN, //used in joinSystem to join
@@ -47,6 +77,7 @@ enum LogType {
 	GOSSIPTO,
 	GOSSIPFROM,
 	BANDWIDTH,
-	MEMBERS};
+	MEMBERS
+};
 
 #endif //MESSAGESTYPES_H
diff --git a/src/FileObject.cpp b/src/FileObject.cpp
index 1f296651a9c40c3818a32d7ec72666bcff1b621a..00ef92aac36ff22cc9f7fe7cc9e9f899b0ca5764 100644
--- a/src/FileObject.cpp
+++ b/src/FileObject.cpp
@@ -22,3 +22,18 @@ int FileObject::getPositionOnHashring(){
     positionOnHashring = hash<string>{}(toBeHashed) % HASHMODULO;
     return 0;
 }
+
+string getMostRecentFile(string readfile){
+    struct dirent *entry = nullptr;
+    DIR *dp = nullptr;
+    int matchLen = readfile.size();
+    vector<string> fileVersions;
+    if ((dp = opendir(".")) == nullptr) { cout << "tmp directory error " << endl; return ""; }
+    while ((entry = readdir(dp))){
+        if (strncmp(entry->d_name, readfile.c_str(), matchLen) == 0){
+            fileVersions.push_back(entry->d_name);
+        }
+    }
+    sort(fileVersions.begin(), fileVersions.end());
+    return fileVersions[fileVersions.size()-1];
+}
diff --git a/src/TcpSocket.cpp b/src/TcpSocket.cpp
index 58c7d4990a949163959a22539999887f5857ef20..d69112beafa628b853e3683883255dfdf4dcb8cd 100644
--- a/src/TcpSocket.cpp
+++ b/src/TcpSocket.cpp
@@ -139,13 +139,13 @@ void TcpSocket::sendLines(string ip, string port, string execfile, string readfi
 	vector<string> unDirectory = splitString(readfile, "-");
 	string toSend = execfile + "," + readfile + "," + to_string(start) + "," + prefix+"-tmp"+to_string(start)+"-"+unDirectory[1];
 	Messages msg(PUT, toSend);
-	cout << "[CHUNK] " << msg.toString() << endl;
+	cout << "[CHUNK] " << messageTypes[msg.type] << " | " << msg.toString() << endl;
 	string payload = msg.toString();
 	if (send(sockfd, payload.c_str(), strlen(payload.c_str()), 0) == -1) {
 		perror("send");
 	}
 	sleep(1);
-	ifstream file(readfile.c_str());
+	ifstream file(getMostRecentFile(readfile));
     string str;
     while (getline(file, str))
     {
@@ -227,7 +227,7 @@ int TcpSocket::messageHandler(int sockfd, string payloadMessage, string returnIP
 				overwriteFilename = fields[4];
 				overwrite = fields[5];
 				if ((stoi(overwrite)) == 0) mode = "ab";
-				cout << "file is " << sdfsfilename << " with size " << filesize << " and checksum " << incomingChecksum << endl;
+				cout << "[PUT] file is " << sdfsfilename << " with size " << filesize << " and checksum " << incomingChecksum << endl;
 				time_t fileTimestamp;
 				time(&fileTimestamp);
 				localfilename = sdfsfilename+"_"+to_string(fileTimestamp);
@@ -242,7 +242,7 @@ int TcpSocket::messageHandler(int sockfd, string payloadMessage, string returnIP
 				sdfsfilename = fields[0]; //exec file name
 				start = stoi(fields[2]); //start line (used just for signalling what work finished to master)
 				remoteLocalname = fields[1]; //actual file (used for signalling)
-				cout << "exec: " << sdfsfilename << ", actual: " << remoteLocalname << ", start: " << fields[2] << ", temp: " << fields[3] << endl;
+				cout << "[PUT] exec: " << sdfsfilename << ", actual: " << remoteLocalname << ", start: " << fields[2] << ", temp: " << fields[3] << endl;
 			}
 			fp = fopen(localfilename.c_str(), mode.c_str());
 			if (fp == NULL) {
@@ -293,7 +293,7 @@ int TcpSocket::messageHandler(int sockfd, string payloadMessage, string returnIP
 		case CHUNK:
 		case CHUNKACK:
 		case DNS:{
-			cout << "Type: " << msg.type << " payloadMessage: " << payloadMessage << endl;
+			cout << "Type: " << messageTypes[msg.type] << " payloadMessage: " << payloadMessage << endl;
 			regMessages.push(payloadMessage); //handle from queue
 			break;
 		}