A step towards a faster implementation
Final commit for the new algorithm with better stopping conditions.