Fix the algorithm. Update the readme.

Semms that now it works perfectly and smoothly.