Cleaned up table generation slightly