I'm a fan of this approach. It really simplifies the problem of dealing with min and max depth. nice work.