For some strange reason my output is garbled in both the 'screen' and 'cu' teerminal programs and 'raw' terminal (stty) mode. I fail to understand why, but let's simply adjust the code as needed for now.