apro_gen: refactoring. stage 1
apro_gen: refactoring. step 2