refactored main application (webserver)