Update serial module to support more patterns