Chanes to main algorithm and some smooth functions