refactor code for generate code
 gencode