Added base class and moved serialport to it.