Refactored the node content setting code