apro_gen refactoring