correct implementation of eliminating nodes, mismatches not yet correct