Almost finished the things of the tabgen
Fixed some bugs,do some optimazation.

z# Changes to be committed: