changed codes slightly
changed to have two nodes