Refactor appServer