added functionality to the leaf node case and IOP is a leaf node case