Added synchronized to prevent multiple thread accessing nodes