Overhaul with Adafruit code