Simplify extracting names and values of nodes.

Signed-off-by: Yorick Peterse <yorickpeterse@gmail.com>