updated prediction logic