improve CGI performace and design