Added early loop detector