Added analog/digital pin functionality and cleanup elsewhere