Use a more flexible stop condition for los algorithm