Added argument to make recursion optional