Added option to disable recursion