refactor for new datastructureg