Refine code to add CGI sample code