Improve loops condition