Syntax changes to main program, moved to own sketch folder to make arduino IDE happy, and moving stuff around to make code more readable... in Notepad++, because programming in the Arduino IDE makes my eyes bleed