refactor data structure to be more workable