safe, sure, well there is some additional wiring for each cell, a LM324 quad op-amp which is used in a voltage difference arrangement, it takes the voltage from the negative terminal to the positive terminal on each cell and converts that to the same voltage relative to ground. for example, say the 3rd cell has a voltage of 3.95V and all the other cells have 3.9V, relative to ground the positive terminal of the third cell is 11.75V, the op-amp takes the voltage from the negative terminal and positive terminal and outputs the difference between them, which is relative to ground so that the AVR can measure the actual cell voltage.
but anyway heres how it actually works, the avr samples each of the cells voltages one after another, then compares them, it calculates the difference between the lowest voltage cell and the highest voltage cell and if it is over the tolerance(12mV in the code). it will output +5V to the VEE in the schematic above of the highest voltage cell. the resistor is to limit the current to 10mA, this lights the diode which activates the photo-transistor, there isn't much of a gain though, the opto-isolator collector current is only about 21mA, so its fed into a darlington transistor which has a current rating of 800mA and a dc gain of over 10,000, that lets me choose how much current i want to bypass the cell by selecting the right value resistor on the collector of the darlington, at 500mA the voltage drop across the collector to emitter is about 1V, so if the cell voltage is 4.2V then the amount of current bypassing the cell would be (4.2 - 1.0) / 6.5 = 492mA, so the end result is that the highest voltage cell is being charged with 500mA less current than the rest of the cells, and they are able to catch up while the highest one charges slower.