refactor table data structure for keys