Add section on ending algorithm