made some rearrangements in case A