total revamp in preparation for fastcgi integration