Affine correlate: Cleaned up implementation.