I don't think the recursing argument is needed here, you can just let path equal nil when you start to call the method and assume if it's non-nil then you're recursing.