Implemented getLeaves