Implement get-nodes function