Add the naive version for residue.