output and write to disk