added isLeaf method