Refactored code of server. Added code to handle command line arguments.