private void dealWithBufferedOperation() {
		Map<Integer, Operation> backupbufferedOperation = new HashMap<Integer, Operation>();
		for(int i: bufferedOperation.keySet()) {
			backupbufferedOperation.put(i, bufferedOperation.get(i));
		}
		
		for (int i: bufferedOperation.keySet()) {
			Operation bufferedOp = bufferedOperation.get(i);
			List<Integer> rwInfo = bufferedOp.getRWinfo();
			Transaction transaction = transactions.get(rwInfo.get(0));
			int varIndex = rwInfo.get(1);
			if(bufferedOp.getType().equals(Type.READ)) {				
				int bufferedOpResult = Integer.MAX_VALUE;
				bufferedOpResult = transactionRWRead(bufferedOp, varIndex, transaction);
				if(bufferedOpResult != Integer.MAX_VALUE){
					System.out.println(bufferedOp.getString()+ " is done. Read result is "+ bufferedOpResult);
					backupbufferedOperation.remove(i);
				}
				if(!transaction.isActive()) {
					backupbufferedOperation.remove(i);
				}
			}
			else { // Type is WRITE, since only READ( from an RW transaction) and WRITE operations need a to wait
				// WRITE 
				boolean writeResult = false;
				int value = rwInfo.get(2);
				writeResult = transactionWrite(bufferedOp, varIndex, transaction, value);	
				if(writeResult) {
					System.out.println(bufferedOp.getString() + " is done.");
					backupbufferedOperation.remove(i);
				}
				if(!transaction.isActive()) {
					backupbufferedOperation.remove(i);
				}
			}		
		}
		bufferedOperation.clear();
		if(!backupbufferedOperation.isEmpty()) {
			for(int i: backupbufferedOperation.keySet()) {
				bufferedOperation.put(i, backupbufferedOperation.get(i));
			}
		}		
		
	}