refactor to simplify new node creation