add sleep timer and modified createserial