public void decodeToFile(BufferedReader br, BufferedWriter bw, int total) throws IOException{
		int input;
		boolean[] new_bits;
		while ((input = br.read()) != -1 && total > 0) {
			if(total <= 0){
				System.out.println("stopped due to max words!");
			}
			new_bits = byteToBooleans(input);
			addToQueue(new_bits);
			while(index > chunkSize){
				writeNextChar(bw);
				total--;
			}
			bw.flush();
		}
		System.out.println("no more to read in, doing rest of the work! total: " + total);
		System.out.println("index size: " + index);
		while(index > 0 && total > 0){
			writeNextChar(bw);
			total--;
		}
		System.out.println("index size: " + index);
		br.close();
		bw.flush();
		bw.close();
	}