Code refactoring. now it will be easy to make the server compatible with future clients