ADC vref bug fix and ADC refactor