code refactoring Analog I/O