Refactoring so that server can server multiple clients