TD2: code cleanup in the client part.