Removed recursive function for getting nodes. uses a list now