Implemented two-phase contention window

Though it's not tested.