some refactoring in main and server menu