Imported code from the Arduino IDE, works but looks terrible