added phase regression and modified last phase template