@Override
	public void run() {
		// Dont perform actions if the cycle is complete (these actions were already performed during the first run)
		if (lastRun) {
			return;
		}
		
		try {
			boolean failedNodeWasOwner;
			
			//Remove failed node from available file locations
			client.removeFileLocation(failedNodeHash);
			
			//If the failed node was owner of any of the local files, send the files to the new owner
			for (String fileName : client.getLocalFiles()) {
				failedNodeWasOwner = nameServer.isFileOwner(failedNodeHash, failedNodeLocation, fileName);
				
				if (failedNodeWasOwner) {
					InetAddress newOwner = nameServer.getFilelocation(fileName);
					// Check if the currect node is the file owner
					if(client.getAddress().equals(newOwner)) {
						int fileHash = nameServer.getShortHash(fileName);
						client.getOwnedFiles().add(new FileRecord(fileName, fileHash));
						
						// Add file to owned files directory and remove it from the local files
						(new File(Client.LOCAL_FILE_PATH + fileName)).renameTo(new File(Client.OWNED_FILE_PATH + fileName));
						client.getLocalFiles().remove(fileName);
						//TODO bestand nog repliceren naar prev node?
					}
					// Else check if the new owner already has the file and let him know the file is available at the current location
					else if (client.getTCPHandler().checkHasOwnedFile(newOwner, fileName)) {
						try {
							client.getUDPHandler().sendMessage(newOwner, Client.UDP_CLIENT_PORT, Protocol.FILE_LOCATION_AVAILABLE, client.getHash() + " " + fileName);
						} catch (IOException e) {
							System.err.println("Error while sending UDP message");
							e.printStackTrace();
						}
					} 
					// If the new owner doesn't have the file yet, send it to him
					else {
						try {
							client.getTCPHandler().sendFile(newOwner, new File(Client.LOCAL_FILE_PATH + fileName), true);
						} catch (IOException e) {
							e.printStackTrace();
							// Remote node could not be reached and should be removed
							client.removeFailedNode(nameServer.reverseLookupNode(newOwner.getHostAddress()));
						}
					}

				}
			}
		} catch (RemoteException e) {
			System.err.println("Error while contacting nameserver");
			e.printStackTrace();
		}
	}