Refactoring the application manager and http server