implemented side parameter for adding new node to root node
merged.