Refactor code to generate one row type per class.