Refactor oneof generator