use nested recursion to render lists in order