implement writing to stdout