cleaned up the serial/no serial code