affine cleanup