Improve generation with class option and fix typo/style