#27 Generalized nodeList method, refactored original solution