Two way communication done
Added checks so that the server won't crash if a client wants to
disconnect