split addNode into two methods