untested  code with serial