Played with the optimization of recursion method