Basic loops detection