Changing add to adc in the highlighted line below significantly improves performance. I find it very counter-intuitive, since ad
add
adc
ad