public void receive() {
		System.out.println("\nClient " + id + " receive buffer: " +  buffer);
		
		if (!buffer.isEmpty()) {
			Operation o = buffer.get(0);
			System.out.println("[TEMP]");
			if (!this.isSynchronized()) {
				System.out.println("[TEMP] before synccheck " + o + " == " + sync);
				if (o.isSync()) {
					System.out.println("[TEMP] Syncing");
					setSynchronizationStatus(o.getReferenceToOperation().getReferenceToOperation());
					//if (syncstatus || !syncstatus) {
						o.syncOperation(state); 
						//o.applyOperation(state);
						System.out.println(state);
						
					//}
					operationHistory.add(o);
					buffer.remove(0);
					
				} else {
					Operation deSyncOperation = new Operation().clone(o);
					deSyncOperation.applyOperation(state);
					operationHistory.add(deSyncOperation);
					/*if (deSyncOperation.syncOperation(state)) {
						operationHistory.add(deSyncOperation);
					}*/
					buffer.remove(0);
				}
				
				
			} else {
				
				operationHistory.add(o);
				
				o.applyOperation(state);
				buffer.remove(0);
				
			}
		
		}
	}