move class_for and type_code_for down in client class.