Refactored : Client server code is  refactored.