Cleaner code, outer loop detected automatically