recursion, closures, and callbacks