added many pieces of the preliminary prediction/optimization system