getNodes method