Working leaves() method