working correctly with ADC readings, yay! still a bit messy though.