Re-implemented Pi Serial without Qt or threads