added table generation code