Merged improved layout of offline version into CGI version.
Fixed merge artifacts and fixed some bugs and did some improvements on offline version.