Implement rewrite_class_def (untested so far)