Refactor data structure for displaying table