added isleaf func to Tree class