Better notation in algorithms, fixed termination criterion