Refactored handling of value nodes.