Change terminal_output, terminal_output_formatted

terminal_output_formatted implements previous terminal_output.
terminal_output uses raw IO.
Changed other functions to use these.