finished code for retrieving a vector of nodes