Cleanup examples

Use loop instead of recursive call.

Signed-off-by: chatgris <jboyer@af83.com>