implement willy's way of cutting off maxdepth