refactor the data structure