moved serial connection related functions to separate file