Can we include your "truth table" of the possible combinations and why you increment one versus the other? That would really help clarify this code.