algorithm should be more stable