Affine cypher + some fixes