adding in some early returns and fixing syntax error on serial.js