start of exercise 2
fixed addNode method