normal calculation with lots of debugging code, alternating arms