algorithm extended

the algorithm is now able to get extended till infinity