tweaks to ensure algo knows when to stop