Extract renderNode method.