Moved output code (stdout/curses) to their own functions.