Extract createAb to factory