Flipped generateNode so it now takes max depth.