Add handling of A inversion and B input