Added serialmode function.