util.puts replaced by process.stdout.write in createDocument