Fixe bug with recursion, performance was optimized