Added logic to add multiple nodes