addNode method implemented