moved functions write, write_line, write_error, write_error_line into module terminal