A lot of changes to make it work on the webserver.