complete, but need more tests for deleteLeaves