refactored the server class