Made IDV recursive for speed.