Restores algorithm for Issue 24