Refactor Chat Server into Seperate File