ADC bug fixes and refactor