update and refact generator, generate to gencode directory