code for adding nodes upon request