Updated the algorithm with mor eaccurate interpolations