Actually, reintro'd iterations of opt logic to be sure we apply all possible optimizations before quitting