implement NodeList and consolidate common scope and context retrieval