Stable algorithm