complete rw code gen