updating recursivity function