changes to 'isRecursive' algorithm