added B1, B2, optimization fixed