code and structure change for using in apache server