added maxDepth argument for getMenuItems