Fix up to not confuse nodes by order. Needs heavy testing.