Refactoring the app server