Rewriting class definitions