Refactored scale and affine