Getting rid of unnecessary recursion (Vicent Marti)