added more provisions for updating node relationships