small changes in recursive auxiliar code