add cgi conf function
code cleanup