example 4-8: limit recursion