Separated the serial function from main.c .