Added functionality to serial so that it drops invalid packets.