refactor for new datastructure and such