refactoring for fast-cgi architecture