added a isValid property to Node class