nice way to exit on recursion