Added a getNext method to Node struct