updated to handle if a client arbitrarily exits his/her application