AES finding affine relations & correspondence for them, refactored