Moved existing logic from Program to HttpServer.