Implemented the two-phase strategt