Refactor to prepare for other methods of adding nodes.