removed unnecessary parameter in recursive function