Fix bugs in CARRY4 output computations and refactor.