Fixing a recursion issue and adding example