changed the way the recursion propagates