Refactor datastructure.