Working for arbitrary leaf sizes