Added recursion function (not working yet, need debug)