added affine stuff, untested
affine seems to work!