Fixed now stoping the recursion properly