Added error checking to main.ino