Better serial port setup, removed global