Smoothed animation. Fixed borders detection.