Correctly manage client state