Merge OnApplyNumberOfPhases into OnApplyBegin