refactor keeping of nodes