removed unnecessary recursive function calls