adapting output generation to cgi