refactoring prediction and including the option for quadratic prediction